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.

We have
$$\int_1^{\infty} \dfrac{\ln^2(x)}{1+x^2}dx = \int_1^0 \dfrac{\ln^2(1/x)}{1+1/x^2} \dfrac{-dx}{x^2} = \int_0^1 \dfrac{\ln^2(x)}{1+x^2}dx$$
Hence, our integral is
$$I = 2\int_0^1 \dfrac{\ln^2(x)}{1+x^2}dx$$
From complex analysis, since $\dfrac1{1+z^2}$ is analytic in the open unit disk, we have $$\dfrac1{1+z^2} = \sum_{k=0}^{\infty}(-1)^kz^{2k}$$
Hence,
$$I = 2\sum_{k=0}^{\infty}(-1)^k \int_0^1 x^{2k}\ln^2(x)dx = 2\sum_{k=0}^{\infty}(-1)^k \dfrac2{(2k+1)^3} = 2 \cdot 2 \cdot \dfrac{\pi^3}{32} = \dfrac{\pi^3}8$$
where the last equality follows from the fact that
$$\text{Li}_n(e^{2\pi ix}) + (-1)^n \text{Li}_n(e^{-2\pi ix}) = -\dfrac{(2 \pi i)^n}{n!} B_n(x)$$
taking $n=3$, $x=1/4$.
