How to solve $\int_0^{\infty} \frac{\log(x+\frac{1}{x})}{1+x^2}dx$? Here is my question
$$\int_0^{\infty} \frac{\log(x+\frac{1}{x})}{1+x^2}dx$$
I have tried it by substituting $x$ = $\frac{1}{t}$. I got the answer $0$ but the correct answer is $\pi log(2)$. Any suggestion would be appreciated.
 A: Instead of using the trigonometric subsitution you may use the identity 
$$\log(1+x^2)=\int_{0}^1 da \frac{x^2}{1+ax^2}$$ 
Calling your integral of interest $I$ It follows that 
$$
I=\int_{0}^1 da \underbrace{\int_{0}^{\infty}dx\frac{x^2}{(x^2+1)(1+ax^2)}}_{\text{use Residue Theorem to calculate this integral}}\\ = \underbrace{\int_{0}^1 da\frac{\pi }{2 \left(a+\sqrt{a}\right)}}_{\text{use}\quad a=b^2\quad \text{to turn this into a standard integral}}=\pi \log (2)
$$
In agreement with Olivier’s answer
A: Approach 1:
\begin{align}
I&=\int_0^{\infty} \frac{\log(x+\frac{1}{x})}{1+x^2}dx\\
&=\int_0^{1} \frac{\log(x+\frac{1}{x})}{1+x^2}dx+\int_1^{\infty} \frac{\log(x+\frac{1}{x})}{1+x^2}dx\\
&=2\int_0^{1} \frac{\log(x+\frac{1}{x})}{1+x^2}dx\\
&=2\int_2^{\infty} \frac{\log(u)}{u\sqrt{u^2-4}}du\\
\end{align}
using $u=x+\frac{1}{x}$ in the last step. Now set $u=2\sec y$ to obtain
\begin{align}
I&=\int_0^{\pi/2} \log(2\sec y)dy\\
&=\frac{\pi}{2}\log2-\int_0^{\pi/2} \log(\cos y)dy\\
&=\pi\log2
\end{align}
using this in the last step.
Approach 2:
$x \to \tan x$
\begin{align}
I&=-\int_0^{\pi/2} \log(\sin x\cos x)dx\\
&=-\int_0^{\pi/2} \log(\sin x)dx+\int_0^{\pi/2} \log(\cos x)dx\\
&=-2\int_0^{\pi/2} \log(\cos x)dx\\
&=\pi \log 2
\end{align}
A: You may write
$$
\begin{align}
\int_0^{\infty} \frac{\log(x+\frac{1}{x})}{1+x^2}dx&=\int_0^{\infty} \frac{\log(1+x^2)-\log x}{1+x^2}dx\\\\
&=\int_0^{\infty} \frac{\log(1+x^2)}{1+x^2}dx-\int_0^{\infty} \frac{\log x}{1+x^2}dx.
\end{align}
$$ Clearly, by the change of variable $ x \to \dfrac 1 x$, we get
$$
\int_0^{\infty} \frac{\log x}{1+x^2}dx=-\int_0^{\infty} \frac{\log x}{1+x^2}dx=0.
$$ On the other hand, by the change of variable $$x= \tan  \theta,  \quad dx =(1+\tan^2 \theta)d\theta, \quad 1+ \tan^2 \theta=\dfrac{1}{\cos^2 \theta},$$ we obtain the classic evaluation:
$$
\int_0^{\infty} \frac{\log(1+x^2)}{1+x^2}dx=-2\int_0^{\pi/2} \log ( \cos \theta) \: d\theta=\pi \log 2.
$$
