Answer
$$\frac{1}{2} (x+2)^2-4(x+2)+ 6\ln (x+2) +c$$
Work Step by Step
Given $$\int \frac{x^{2}+2}{x+2} d x$$
Let $u=x+2\ \ \Rightarrow \ \ \ du=dx$ , then
\begin{align*}
\int \frac{x^{2}+2}{x+2} d x&=\int \frac{(u-2)^{2}+2}{u} d u\\
&=\int \frac{u^2-4u+6}{u} d u\\
&=\int \left( u-4+ \frac{ 6}{u} \right) d u\\
&= \frac{1}{2} u^2-4u+ 6\ln {u} +c\\
&=\frac{1}{2} (x+2)^2-4(x+2)+ 6\ln (x+2) +c
\end{align*}