TITLE: Definite integral involving logarithm of cosine
QUESTION [7 upvotes]: Does anyone know the provenance of or the answer to
the following integral
$$\int_0^\infty\ \frac{\ln|\cos(x)|}{x^2} dx $$
Thanks.

REPLY [7 votes]: Lucian's answer is just fine (as always), but from
$$ \sum_{n\in\mathbb{Z}}\frac{1}{(x+n\pi)^2}=\frac{1}{\sin^2 x}\tag{1}$$
for any $x\in(-\pi,\pi)$ it also follows that:
$$ I = \frac{1}{2}\int_{0}^{+\infty}\frac{\log\cos^2 x}{x^2}\,dx = \frac{1}{2}\int_{-\pi/2}^{\pi/2}\frac{\log\cos x}{\sin^2 x}\,dx=-\frac{1}{2}\int_{0}^{+\infty}\frac{\log(1+t^2)}{t^2}\,dt$$
by replacing $x$ with $\arctan t$ in the last step. Integration by parts now leads to:
$$ I = -\int_{0}^{+\infty}\frac{dt}{1+t^2} = \color{red}{-\frac{\pi}{2}}.\tag{2}$$
Someone may ask now: How to prove $(1)$? 
Well, for such a purpose, start from the Weierstrass product for the sine function:
$$\frac{\sin z}{z}=\prod_{n\geq 1}\left(1-\frac{z^2}{\pi^2 n^2}\right)$$
then consider the logarithm of both sides and differentiate it twice with respect to $z$.