TITLE: How to solve $\int_0^{\pi/2} \ln{(x^2 + \ln^2{(\cos{x})})} \,\mathrm{d}x$
QUESTION [16 upvotes]: $$\int_0^{\pi/2}  \ln{(x^2 + \ln^2{(\cos{x})})} \,\mathrm{d}x$$
I was given this integral yesterday by someone on a forum and after a few hours of having a go at it I didn't really get anywhere significant.
My first idea was to use a series of substitutions which would simply the integral into a form where taylor expansions could be used to solve it. Another idea of mine was to use complex numbers to get rid of some of the log terms, changing the $\ln^2{(\cos{x})}$ term could possibly make this integral a lot more manageable. 
I'd prefer if someone could help me solve this using basic methods although if there is a more complicated but elegant solution (using contour integration for example) it could still be beneficial to someone else. We don't do the equivalent of Calc III in my school so I am not very familiar with methods which go beyond the Calc II syllabus (DUDIS, Laplace ect..).

REPLY [4 votes]: Following the comment left by @tired, we note that we can factor the argument of the quadratic as 
$$x^2+\log^2(\cos(x))=(\log(\cos(x)+ix)(\log(\cos(x)-ix)$$
Writing $ix=\log(e^{ix})$ we have
$$x^2+\log^2(\cos(x))=\left|\log(\cos(x)e^{ix})\right|^2=\left|\log\left(\frac{1+e^{i2x}}{2}\right)\right|^2$$
Next, we write the integral of interest as
$$\int_0^{\pi/2}\log(x^2+\log^2(\cos(x)))\,dx=\frac14\int_{-\pi}^{\pi}\log\left(\left|\log\left(\frac{1+e^{ix}}{2}\right)\right|^2\right)\,dx$$
We move to the complex plane by letting $z=e^{ix}$.  The integral of interest becomes
$$\begin{align}
\int_0^{\pi/2}\log(x^2+\log^2(\cos(x)))\,dx&=\frac12\oint_{|z|=1}\log\left(\left|\log\left(\frac{1+z}{2}\right)\right|\right)\frac{1}{iz}\,dz\\\\
&=\frac12\text{Re}\left(\oint_{|z|=1}\log\left(\log\left(\frac{1+z}{2}\right)\right)\frac{1}{iz}\,dz\right)\\\\
&=\frac12 \text{Re}\left(2\pi i \left(\frac{\log(\log(2))+i\pi}{i}\right)\right)\\\\
&=\pi \log(\log(2))
\end{align}$$
where we tacitly deformed the contour around the branch point singularities at $z=1$ and $z=-1$ and noted that the contributions from integrations around the deformations are zero.