Answer
$$x-2 \ln |x+2|+C $$
Work Step by Step
Given
$$\int \frac{x}{x+2} d x $$
Let $ u= x+2\ \ \to du =dx$
Then\begin{aligned} \int \frac{x}{x+2} d x &=\int \frac{u-2}{u} d u \\ &=\int \frac{u}{u} d u-\int \frac{2}{u} d u \\ &=\int 1 d u-\int \frac{2}{u} d u \\ &=u-2 \ln |u|+C \\ &=x+2-2 \ln |x+2|+C_{1} \\ &=x-2 \ln |x+2|+C \end{aligned}
Or by partial fractions
\begin{aligned} \int \frac{x}{x+2} d x &=\int 1 d x-\int \frac{2}{x+2} d x \\ &=x-2 \ln |x+2|+C \end{aligned}