improper integral with an absolute value

I want to show that $\displaystyle \int^{\infty}_{0} \frac{\ln (|\tan x| )}{1+x^{2}} \ dx = \frac{\pi}{2} \ln (\tanh 1)$.

With regard to convergence, we know that $\displaystyle \int^{\frac{\pi}{2}}_{0} \ln(|\tan x)| dx = \int^{\frac{\pi}{2}}_{0} \ln(\tan x) \ dx$ converges. It was just shown that it evaluates to zero in another thread. But that doesn't necessarily mean that $\displaystyle \int^{\frac{\pi}{2}}_{0} \big|\ln(\tan x)\big| \ dx$ converges. If the latter is true though, then showing that $\displaystyle \int^{\infty}_{0} \frac{\ln (|\tan x| )}{1+x^{2}} \ dx$ converges is fairly straight forward.

As for evaluating $\displaystyle \int^{\infty}_{0} \frac{\ln (|\tan x| )}{1+x^{2}} \ dx$, I've been stumped for a few days.

-
How about: $$\int_0^\infty \frac{\log | \tan x |}{1+x^2} \mathrm{d} x = \frac{1}{2} \int_0^\infty \frac{\log \tan^2 x }{1+x^2} \mathrm{d} x = \frac{1}{4} \int_{-\infty}^\infty \frac{\log \tan^2 x }{1+x^2} \mathrm{d} x \tag{\ast}$$ Writing the integral over $\mathbb{R}$ as the average of integrals over $\mathbb{R} + i \epsilon$ and $\mathbb{R} - i \epsilon$ and using $\vert \tan(z) \vert^2 = \frac{\sin^2(2 x) + \sinh^2(2y)}{(\cos(2x) + \cosh(2y))^2} \to_{y \to \pm \infty} 1$ we can complete the integration contours and apply the residue theorem: $$\begin{eqnarray} \int_{-\infty}^\infty \frac{\log \tan^2 x }{1+x^2} \mathrm{d} x &=& \frac{1}{2} \int_{-\infty +i 0}^{\infty +i 0} \frac{\log \tan^2 x }{1+x^2} \mathrm{d} x + \frac{1}{2} \int_{-\infty-i 0}^{\infty - i 0} \frac{\log \tan^2 x }{1+x^2} \mathrm{d} x \\ &=& \frac{1}{2} \cdot 2 \pi i \operatorname{Res}_{x=i}\frac{\log \tan^2 x }{1+x^2} - \frac{1}{2} \cdot 2 \pi i \operatorname{Res}_{x=-i}\frac{\log \tan^2 x }{1+x^2} \\ &=& 2 \pi \log \tanh(1) \end{eqnarray}$$ Combining with eq. $(\ast)$: $$\int_0^\infty \frac{\log | \tan x |}{1+x^2} \mathrm{d} x = \frac{\pi}{2} \log \tanh(1)$$
@RandomVariable The integral just above the real line is closed by couter-clock-wise arc from $+\infty$ to $i \infty$ to $-\infty$, and the integral just below the real line is closed by a clock-wise arc from $+\infty$ to $-i \infty$ to $-\infty$. –  Sasha Jan 24 '13 at 19:28
So what you're finding is the principal value of an integral that goes through infinitely-many isolated singular points by averaging the values of the integrals just above and just below the singularities? And that fact about $\vert \tan(z) \vert^2$ is why we can close the contours in the upper half and lower half planes? Did we need to define a branch cut because we're dealing with log? –  Random Variable Jan 24 '13 at 20:02
@RandomVariable Yes to the first two questions. The branch cut of the $\log$ is chosen along the negative real semi-axis. The only subtle point is to show that $\tan^2(z)$ does not cross $\log$'s branch cuts along the contour. –  Sasha Jan 24 '13 at 20:45