Evaluate $\int_0^{\infty} \frac{\log(x)dx}{x^2+a^2}$ using contour integration

Take these lines as a long comment and not an answer, but the integral is trivial to compute through real-analytic techniques. For any $a>0$ we have:

$$ \int_{0}^{+\infty}\frac{\log(x/a)}{a^2+x^2}\,dx = \frac{1}{a}\int_{0}^{+\infty}\frac{\log x}{1+x^2}=\color{red}{0} $$ since the substitution $x\mapsto\frac{1}{x}$ gives $\int_{1}^{+\infty}\frac{\log x}{1+x^2}\,dx = -\int_{0}^{1}\frac{\log x}{1+x^2}\,dx $.
On the other hand, $$ \int_{0}^{+\infty}\frac{\log(a)}{a^2+x^2}\,dx = \frac{\log a}{a}\int_{0}^{+\infty}\frac{dx}{1+x^2}=\color{red}{\frac{\pi\log a}{2a}}.$$

If you want to use contour integration, you may take a semicircular contour in the right half-plane with three bulges around $z=0$ (singularity for $\log z$) and $z=\pm i a$ (singularities for $\frac{1}{z^2+a^2}$), then apply the residue theorem. The integral over the outer arc is vanishing as $R\to +\infty$ since it is bounded by $\frac{2\pi\log R}{R}$ in absolute value for any $R$ big enough.


Notice that the real part of $f (z)= \frac {\log (z)}{z^2+a^2}$ is symmetric along the origin. Then $$Re \int_{-R}^{R}f (z)dz=2\int_{0}^{R}f (x)dx$$ Now we close the contour by making a semicircle of radius $R $ along the positive imaginary axis and take the limit as $R \to \infty $. So $$\int_{\gamma}\frac {\log(z)}{z^2+a^2}dz=\int_{-R}^{R} \frac {\log(x)}{x^2+a^2}dx+\int_{\gamma'}\frac { \log(z)}{z^2+a^2}dz$$ Where $\gamma'$ is the top part of the semicircle. By the Estimation Lemma the top integral is bounded as $$\mid\int_{\gamma'}\frac {\log(z)}{z^2+a^2}dz \mid \le \pi\frac { \sqrt {(\log^2(R)+\pi^2)}}{R} $$ which vanishes as $R \to \infty $. Now since the value of the real integral is the only contribution to the contour integral we apply the Residue Theorem $$\int_{-\infty}^{\infty} \frac {\log(x)}{x^2+a^2}dx= \pi \frac {\log(a)+i\pi/2}{a}$$ But since we are not integrating over the branch cut in $$\int_{0}^{\infty} \frac {\log (x)}{x^2+a^2}dx$$ and the real part is symmetric we can conclude $$\int_{0}^{\infty} \frac { \log(x)}{x^2+a^2}dx=\pi \frac { \log(a)}{2a}$$


The substitution $x=at$ gives:

$$\int_0^{\infty} \frac{\log(x)dx}{x^2+a^2} dx=\frac{1}{a}\int_{0}^{\infty} \frac{\log(at)}{1+t^2} dt$$

$$=\frac{1}{a} \int_{0}^{\infty} \frac{\log t +\log a}{1+t^2} dt$$

Note

$$\int_0^{\infty} \frac{\log(x)dx}{x^2+1}=0$$

This can be proved with the substitution $x=\frac{1}{u}$