Step 1: Understanding the Concept:
When the numerator has the same degree as the denominator, divide first. Here we rewrite \(x=(x+2)-2\).
Step 2: Split the fraction:
\[ \frac{x}{x+2}=\frac{(x+2)-2}{x+2}=1-\frac{2}{x+2} \]
Step 3: Integrate:
The integral of 1 is \(x\). The integral of \(\frac{1}{x+2}\) is \(\log|x+2|\), because the derivative of \(x+2\) is 1. The constant 2 stays outside.
\[ \int\left(1-\frac{2}{x+2}\right)dx=x-2\log|x+2|+c \]
Here \(c\) is the constant of integration.
Step 4: Check by differentiating:
\(\frac{d}{dx}\left[x-2\log(x+2)\right]=1-\frac{2}{x+2}=\frac{x}{x+2}\), which is the original integrand.
Step 5: Why the other options are wrong:
Options (A) and (B) have a plus sign, but the split gives a minus. Option (C) has the coefficient 1 instead of 2, which loses the factor 2 in the numerator.
Final Answer:
The integral is \(x-2\log(x+2)+c\), option (D).
\[ \boxed{x-2\log(x+2)+c} \]