TITLE: Evaluating $\int_0^\pi\arctan\bigl(\frac{\ln\sin x}{x}\bigr)\mathrm{d}x$
QUESTION [31 upvotes]: I found the following integral as a by product of another one. 
It has a nice closed form.

$$
\int_{0}^{\pi}
\arctan\left(\ln\left(\sin x \right) \over x\right)\,{\rm d}x 
$$

Mathematica and Maple fail to give the answer. Could you find it?
Hint 1: 
The closed form is 

$$
-\pi\arctan \left(2\ln 2  \over \pi\right) 
$$

Hint 2: 
The following integral may help 

$$
\int_{0}^{\pi}{x \over x^{2} + \ln^{2}\left(\alpha\sin x \right)}
\,{\rm d}x
$$ 

(see this post).

REPLY [9 votes]: $\def\Im{\mathrm{Im}}$
I hope it is not too late to present an alternative solution.
Let
\begin{align}
I(s)=\int^\pi_0\arctan\left(\frac{\ln(s\sin{x})}{x}\right)\mathrm{d}x
\end{align}
Differentiate under the integral sign to get
\begin{align}
I'(s)
&=\frac{1}{s}\int^\pi_0\frac{x}{x^2+\ln^2(s\sin{x})}\mathrm{d}x\\
&=-\frac{1}{s}\Im\int^\pi_0\frac{1}{\ln\left(\frac{se^{i2x}-s}{2i}\right)}\mathrm{d}x\\
&=-\frac{1}{s}\Im\int_{|z|=1}\frac{1}{\ln\left(\frac{sz-s}{2i}\right)}\frac{\mathrm{d}z}{2iz}\\
&=-\frac{1}{s}\Im\frac{\pi}{\ln\left(-\frac{s}{2i}\right)}\\
&=-\frac{1}{s}\Im\frac{\pi}{\ln\left(\frac{s}{2}\right)+\frac{\pi i}{2}}\frac{\ln\left(\frac{s}{2}\right)-\frac{\pi i}{2}}{\ln\left(\frac{s}{2}\right)-\frac{\pi i}{2}}\\
&=\frac{1}{2s}\frac{\pi^2}{\ln^2\left(\frac{s}{2}\right)+\frac{\pi^2}{4}}
\end{align}
where the fourth equality follows from the residue theorem and the fact that the indent around the branch point $z=1$ produces no contribution as $\epsilon\to0$.
Integrating back,
\begin{align}
I(1)
&=I(\infty)+\frac{\pi^2}{2}\int^{s=1}_{s=\infty}\frac{1}{\ln^2\left(\frac{s}{2}\right)+\frac{\pi^2}{4}}\mathrm{d}\ln\left(\frac{s}{2}\right)\\
&=\frac{\pi^2}{2}+\left.\frac{\pi^2}{2}\frac{2}{\pi}\arctan\left(\frac{2\ln\left(\frac{s}{2}\right)}{\pi}\right)\right|^1_\infty\\
&=-\pi\arctan\left(\frac{2\ln{2}}{\pi}\right)
\end{align}
as desired.