Evaluate $\int_0^\infty \frac{(\log x)^2}{1+x^2} dx$ using complex analysis How do I compute 

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

What I am doing is take 
$$f(z)=\frac{(\log z)^2}{1+z^2}$$
and calculating 
$\text{Res}(f,z=i) = \dfrac{d}{dz} \dfrac{(\log z)^2}{1+z^2}$
which came out to be $\dfrac{\pi}{2}-\dfrac{i\pi^2}{8}+\dfrac{i\pi}{2}$
Im not too sure how to move on from here. the given answer is $\dfrac{\pi^3}{8}$
Any help will be appreciated. thank you in advanced.

I would consider the following contour integral
$$\oint_C dz \frac{\log^3{z}}{1+z^2} $$
where $C$ is a keyhole contour of outer radius $R$ and inner radius $\epsilon$, about the positive real axis.  Without explicitly showing that the integrals over the outer and inner circles vanish as $R\to\infty$ and $\epsilon \to 0$, the integral is equal to
$$\int_0^{\infty} dx \frac{\log^3{x}-(\log{x}+i 2 \pi)^3}{1+x^2} = -i 6 \pi \int_0^{\infty} dx  \frac{\log^2{x}}{1+x^2} + 12 \pi^2 \underbrace{\int_0^{\infty} dx  \frac{\log{x}}{1+x^2}}_{0} + \\i 8 \pi^3 \underbrace{\int_0^{\infty} dx  \frac{1}{1+x^2}}_{\pi/2} $$
The contour integral is also equal to the sum of the residues of the integrand at the poles $z=\pm i$:
$$-i 6 \pi \int_0^{\infty} dx  \frac{\log^2{x}}{1+x^2} + i 4 \pi^4 = i 2 \pi \left (\frac{-i \pi^3/8}{2 i} + \frac{-i 27\pi^3/8}{-2 i} \right ) = i \frac{13 \pi^4}{4}$$
Note that the keyhole contour demands that $\arg{z} \in [0,2\pi]$.  Thus,
$$\int_0^{\infty} dx \frac{\log^2{x}}{1+x^2} = \frac{\pi^3}{8} $$
