<s>[INST] Definite Integral $\int_0^{\pi/2} \frac{\log(\cos x)}{x^2+\log^2(\cos x)}dx = \frac{\pi}{2}\left(1-\frac{1}{\log 2}\right)$ I want to prove that
$$\int_0^{\pi/2} \frac{\log(\cos x)}{x^2+\log^2(\cos x)}dx = \frac{\pi}{2}\left(1-\frac{1}{\log 2}\right)$$
 [/INST] Note that for $|x| < \frac{\pi}{2}$, we have
$$ \frac{\log\cos x}{\log^2 \cos x + x^2} = \Re \frac{1}{\log\left( \frac{1+e^{2ix}}{2} \right)}. $$
Thus if $I$ denotes the given integral, we have
\begin{align*}
I
&= \frac{1}{2}\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \Re \frac{1}{\log\left( \frac{1+e^{2ix}}{2} \right)} \, dx \\
&= \frac{1}{4} \mathrm{PV}\int_{-\pi}^{\pi} \Re \frac{1}{\log\left( \frac{1+e^{ix}}{2} \right)} \, dx \\
&= \frac{1}{4} \Re \mathrm{PV}\int_{-\pi}^{\pi} \frac{1}{\log\left( \frac{1+e^{ix}}{2} \right)} \, dx.
\end{align*}
Now let $C_{\epsilon}$ be the counter-clockwised contour consisting of the circle of radius 1 centered at the origin, with two semicircular indents $\gamma_{1,\epsilon}$ around $1$ and $\gamma_{2,\epsilon}$ around $-1$ as follows:

By writing
\begin{align*}
I = \frac{1}{4} \Re \lim_{\delta\to0^{+}}\left( \int_{-\pi+\delta}^{-\delta} + \int_{\delta}^{\pi-\delta} \right) \frac{1}{\log\left( \frac{1+e^{ix}}{2} \right)} \, dx
\end{align*}
and plugging the substitution $z = e^{ix}$, we observe that
\begin{align*}
I = \frac{1}{4} \Im \lim_{\epsilon\to 0^{+}}\left(\oint_{C_{\epsilon}} - \int_{\gamma_{1,\epsilon}} - \int_{\gamma_{2,\epsilon}} \right) \frac{dz}{z \log\left(\frac{1+z}{2}\right)}
\end{align*}
Let 
\begin{align*}
f(z) = \frac{1}{z \log\left(\frac{1+z}{2}\right)}.
\end{align*}
It is plain from the logarithmic singularity that
\begin{align*}
\lim_{\epsilon \to 0^{+}} \int_{\gamma_{2,\epsilon}} f(z) \, dz = 0.
\end{align*}
Also it follows that
\begin{align*}
\lim_{\epsilon\to 0^{+}} \oint_{C_{\epsilon}} f(z) \, dz
&= 2\pi i \operatorname{Res}_{z=0} f(z)
 = -\frac{2\pi i}{\log 2}, \\
\lim_{\epsilon\to 0^{+}} \int_{\gamma_{1,\epsilon}} f(z) \, dz
&= -\pi i \operatorname{Res}_{z=1} f(z)
 = -2\pi i.
\end{align*}
Therefore we have
\begin{align*}
I
&= \frac{1}{4} \Im \left( 2\pi i - \frac{2\pi i}{\log 2} \right)
 = \frac{\pi}{2} \left( 1 - \frac{1}{\log 2} \right).
\end{align*}
</s>