Solution (source code)

= Solution

Choose a branch of the <complex logarithm> with $-\pi/2<\arg z<3\pi/2$, placing its <branch cut> down the negative imaginary axis. Thus $\operatorname{Log} x=\ln x$ for $x>0$, while $\operatorname{Log}(-x)=\ln x+i\pi$ on the negative real axis for $x>0$.

Integrate $\operatorname{Log} z/(z^2+a^2)$ around an upper <semicircle>, with a small clockwise semicircular indentation above zero. The large arc contributes $O(\ln R/R)\to0$, and the small arc contributes $O(\varepsilon|\ln\varepsilon|)\to0$. The only enclosed <pole> is $ia$, with
$$
\operatorname{Res}_{z=ia}\frac{\operatorname{Log} z}{z^2+a^2}=\frac{\ln a+i\pi/2}{2ia}.
$$
Writing $I(a)$ for the required integral, the negative real segment contributes $I(a)+i\pi\int_0^\infty dx/(x^2+a^2)$. Hence the <residue theorem> gives
$$
2I(a)+\frac{i\pi^2}{2a}=\frac\pi a\left(\ln a+\frac{i\pi}{2}\right).
$$
The imaginary terms cancel, leaving
$$
\boxed{\int_0^\infty\frac{\ln x}{x^2+a^2}\,dx=\frac{\pi\ln a}{2a}.}
$$
The integral converges at both endpoints because $|\ln x|$ is integrable near zero and $\ln x/x^2$ is integrable at infinity. As a real-variable check, scaling $x=au$ reduces the result to the vanishing first logarithmic moment at $a=1$, one of the <logarithmic moments of the Cauchy kernel>.