Why is $\int_{-\infty}^{\infty}\left\lvert\log\frac{a^2+x^2}{b^2+x^2}\right\rvert dx=2\pi(b-a)$? 
If $a,b\in\mathbb R_{>0}$ and $ b>a$, then why is $\int_{-\infty}^{\infty}\left\lvert\log\frac{a^2+x^2}{b^2+x^2}\right\rvert dx=2\pi(b-a)$ ?

Usual change of variables doesnt bring anything, I think. Is there a special function involved here (because of $\pi$) ?
 A: We want to prove $\int_\mathbb{R}\ln\frac{b^2+x^2}{a^2+x^2}db=2\pi(b-a)$. This is certainly true when $b=a$. And since $\int_\mathbb{R}\frac{2b}{b^2+x^2}dx=[2\arctan\frac{x}{b}]^\infty_{-\infty}=2\pi$, integrating with respect to $b$ completes the proof.
A: 
METHODOLOGY $1$:

Note that we can write
$$\begin{align}
\int_{-\infty}^\infty\log\left(\frac{b^2+x^2}{a^2+x^2}\right)\,dx&=2\int_0^\infty \int_{a^2}^{b^2} \frac{1}{y+x^2}\,dy\,dx\\\\
&\overbrace{=}^{\text{Fubini}}2\int_{a^2}^{b^2}\int_0^\infty \frac{1}{y+x^2}\,dx\,dy\\\\
&=2\int_{a^2}^{b^2}\frac{\pi/2}{\sqrt y}\,dy\\\\
&=2\pi (b-a)
\end{align}$$
as expected!


METHODOLOGY $2$:

Alternatively, we can integrate $\int \log(a^2+x^2)\,dx$ by parts with $u=\log(a^2+x^2)$ and $v=x$ to find
$$\begin{align}
\int \log(a^2+x^2)\,dx&=x\log(a^2+x^2)-2\int \frac{x^2}{a^2+x^2}\,dx\\\\
&=x\log(a^2+x^2)-2x+2a\arctan(x/a)
\end{align}$$
And the rest is straightforward.
A: \begin{align*}
\int_{-M}^{M}\left|\log\dfrac{a^{2}+x^{2}}{b^{2}+x^{2}}\right|dx&=\int_{-M}^{M}\log\dfrac{b^{2}+x^{2}}{a^{2}+x^{2}}dx\\
&=\int_{-M}^{M}\log(b^{2}+x^{2})dx-\int_{-M}^{M}\log(a^{2}+x^{2})dx,
\end{align*}
where
\begin{align*}
\int_{-M}^{M}\log(b^{2}+x^{2})dx&=2M\log(b^{2}+M^{2})-\int_{-M}^{M}\dfrac{2x}{b^{2}+x^{2}}dx\\
&=2M\log(b^{2}+M^{2})-4M+ 2b^{2}\int_{-M}^{M}\dfrac{1}{x^{2}+b^{2}}dx\\
&=2M\log(b^{2}+M^{2})-4M+4b\tan^{-1}\dfrac{M}{b},
\end{align*}
and so 
\begin{align*}
&\int_{-M}^{M}\log(b^{2}+x^{2})dx-\int_{-M}^{M}\log(a^{2}+x^{2})dx\\
&=2M\log\dfrac{b^{2}+M^{2}}{a^{2}+M^{2}}+4b\tan^{-1}\dfrac{M}{b}-4a\tan^{-1}\dfrac{M}{a}\\
&\rightarrow0+4b\cdot\dfrac{\pi}{2}-4a\cdot\dfrac{\pi}{2}\\
&=2\pi(b-a).
\end{align*}
A: By parity, the integral equals $2\int_{0}^{+\infty}\left|\log\frac{a^2+x^2}{b^2+x^2}\right|\,dx $. Since $b>a$, we have $\frac{a^2+x^2}{b^2+x^2}\in(0,1)$ for any $x\in\mathbb{R}^+$ and the previous integral equals $2\int_{0}^{+\infty}-\log\frac{a^2+x^2}{b^2+x^2}\,dx $ or, by setting $x=\sqrt{z}$ and $a^2=A,b^2=B$,
$$ \int_{0}^{+\infty}\frac{\log(B+z)-\log(A+z)}{\sqrt{z}}\,dz\stackrel{z=Aw}{=} a\int_{0}^{+\infty}\frac{\log\left(\frac{B}{A}+w\right)-\log(1+w)}{\sqrt{w}}\,dw.$$
For any $\theta>1$ the following integral can be easily managed through Feynman's trick or simply Fubini's theorem:
$$\begin{eqnarray*} \int_{0}^{+\infty}\frac{\log(\theta+w)-\log(1+w)}{\sqrt{w}}\,dw&=&\int_{0}^{+\infty}\int_{1}^{\theta}\frac{1}{(u+v)\sqrt{v}}\,du\,dv\\&=&\int_{0}^{+\infty}\int_{1}^{\theta}\frac{2}{(u+v^2)}\,du\,dv\\&=&\int_{1}^{\theta}\frac{\pi}{\sqrt{u}}\,du=2\pi(\sqrt{\theta}-1)\end{eqnarray*} $$
proving the claim through straightforward manipulations.
