Integrating $\int_{-\frac{\pi}{4}}^{\frac{\pi}{4}} \frac{\log\left( x^2 + 2 x \sin(\theta) + 1 \right)}{x + 2 \sin(\theta)} d\theta$ Let $x>0$. I've encountered the following integral:
$$
I(x) \ = \ \int_{-\frac{\pi}{4}}^{\frac{\pi}{4}} \frac{\log\left( x^2 + 2 x \sin(\theta) + 1 \right)}{x + 2 \sin(\theta)} d\theta
$$
Is there a way to integrate this? I've been looking through Gradshteyn and Ryzhik, and I have found some similar integrals but nothing that looks exactly like this. Maybe through a contour integration?
If there is no way to integrate this, is it possible to derive asymptotics for the above $I(x)$ in the limit $x \to \infty$?
 A: If you make the standard substitution $\theta = 2 \arctan u$, the integrand becomes
$$\frac {\ln \frac {P(u)} {Q(u)}} {R(u)},$$
where $P, Q, R$ are quadratic polynomials. Factoring the polynomials and formally expanding the logarithm reduces the indefinite integral to a sum of integrals of the form
$$\int \frac {\ln u} {u + a} du =
\ln u \ln \left( 1 + \frac u a \right) +
 \operatorname{Li}_2 \left( - \frac u a \right).$$
With the natural choice of the factors, the antiderivative will be continuous in $u$ for large positive $x$, yielding a closed form for the definite integral.
To obtain the asymptotic, you can simply expand the integrand around $x = \infty$ and integrate term by term:
$$\frac {\ln (x^2 + 2 x \sin \theta + 1)} {x + 2 \sin \theta} = \\
\frac {2 \ln x} x - \frac {4 \ln x \sin t - 2 \sin t } {x^2} +
 \frac {8 \ln x \sin^2 t + \cos 2 t - 4 \sin^2 t} {x^3} + o(x^{-3}), \\
I(x) = \frac {\pi \ln x} x +
 \frac {2 (\pi - 2) \ln x - \pi + 3} {x^3} + o(x^{-3}).$$
A: For $x$ sufficiently large, and putting all in the form 
$$2\int_{-\pi/4}^{\pi/4} \frac{\log(x)}{x}\cdot \frac{\textrm{d}\theta}{1+2\sin(\theta)/x}+\int_{-\pi/4}^{\pi/4} \frac{\log\left(1 + 1/x (2\sin(\theta) + 1/x) \right)}{x }\cdot \frac{\textrm{d}\theta}{1+2\sin(\theta)/x} $$
combined with the power series of $\log(1+x)$ and $\displaystyle \frac{1}{1+x}$, and integrating termwise, we arrive, for example, at the asymptotical behaviour
$$I(x)\approx\pi\frac{\log(x)}{x}+\frac{2(\pi-2)\log(x)+3-\pi}{x^3}+\frac{12(3\pi-8)\log(x)-21\pi+64}{6x^5}.$$
