Step 1: Plan the check by differentiation:
The answer is one of four given functions. We differentiate the likely one and compare with the integrand.
Step 2: Differentiate option (D):
Let $F(x)=x\sin(\log x)$. Use the product rule.
\[ F^{\prime}(x)=\sin(\log x)+x\cdot\cos(\log x)\cdot\frac{1}{x} \]
\[ F^{\prime}(x)=\sin(\log x)+\cos(\log x) \]
This is exactly the integrand.
Step 3: Reject the rest:
For (A), $\frac{d}{dx}\left[-\cos(\log x)\right]=\frac{\sin(\log x)}{x}$, which has an extra factor $\frac{1}{x}$ and no cosine term.
For (C), $\frac{d}{dx}\sin(\log x)=\frac{\cos(\log x)}{x}$, again with the factor $\frac{1}{x}$ and no sine term.
For (B), the derivative is made of $\sec x\tan x$ and $\csc x\cot x$ terms, which are not the integrand.
Step 4: Cross-check with integration by parts:
\[ \int \sin(\log x)\,dx=x\sin(\log x)-\int \cos(\log x)\,dx \]
Add $\int \cos(\log x)\,dx$ to both sides. The cosine integral cancels.
\[ \int \left[\sin(\log x)+\cos(\log x)\right]dx=x\sin(\log x)+C \]
Final Answer:
The integral equals $x\sin(\log x)+C$, option (D).
\[ \boxed{x\sin(\log x)+C} \]