How to evaulate $\int_0^{\infty}\frac{\ln x}{\sqrt{x}(x^2+a^2)^2}$ using contour integration I'm asked to calculate the following integral for which $0 \neq a \in \mathbb{R}$:
$$\int_0^{\infty}\frac{\ln x}{\sqrt{x}(x^2+a^2)^2}$$
I'm confused about which contour I should use, whether it should be a semi-circle deformed to avoid the origin, or a keyhole contour based on a similar question I found here: Calculating $\int_0^{\infty } \frac{\ln (x)}{\sqrt{x} \left(a^2+x^2\right)^2} \, \mathrm{d}x$ using contour integration (but this question did not go into detail about how the integration was carried out using the keyhole contour)
Also, after deciding on which contour to use, how do I proceed from there to evaluate this integral? I know that I would eventually have to use the Residue Theorem but how do I isolate the part of the contour only going from $0$ to $\infty$?

We integrate with $a$ a positive real
$$f(z) = \frac{\mathrm{Log}(z)}{(z-ai)^2 (z+ai)^2}
\exp(-1/2\times \mathrm{Log}(z))$$
around a  keyhole contour  with the  slot on  the positive  real axis,
which  is also  where  the  branch cut  of  the  logarithm is  located
(argument of  the logarithm is  between $0$  and $2\pi$). Now  for the
large circle we get $\lim_{R\to\infty} 2\pi R \log R / \sqrt{R} /R^4 =
0$ so  there is no  contribution in the  limit.  For the  small circle
around the  origin we find  $\lim_{\epsilon\to\ 0} 2\pi  \epsilon \log
\epsilon /  \sqrt\epsilon /a^4 = 0$  so there is no  contribution here
either. 
We get for the upper line segment
$$\int_0^\infty \frac{\log x}{(x^2+a^2)^2}
\exp(-1/2\times \log x) \; dx$$
which is  our target  integral, call  it $J$.  The lower  line segment
contributes
$$-\int_0^\infty \frac{\log x + 2\pi i}{(x^2+a^2)^2}
\exp(-1/2\times \log x) \exp(-1/2\times 2\pi i) \; dx
\\ = \int_0^\infty \frac{\log x + 2\pi i}{(x^2+a^2)^2}
\exp(-1/2\times \log x) \; dx
\\ = J + 2\pi i \int_0^\infty \frac{1}{(x^2+a^2)^2}
\exp(-1/2\times \log x) \; dx = J + 2\pi i K$$
where $J$ and $K$ are real numbers. We thus have
$$2J + 2\pi i K = 2\pi i  \mathrm{Res}_{z=ai} f(z)
+ 2\pi i  \mathrm{Res}_{z=-ai} f(z)$$
or
$$J + \pi i K = \pi i  \mathrm{Res}_{z=ai} f(z)
+ \pi i  \mathrm{Res}_{z=-ai} f(z)$$
With this  setup we  do not actually  need to compute  $K$ as  it must
correspond  to the  imaginary part  of the  contribution from  the two
residues. We get for the first residue at $z=ai$ the derivative
$$\frac{1}{z} \frac{1}{(z+ai)^2} \exp(-1/2\times \mathrm{Log}(z))
-2 \mathrm{Log}(z) 
\frac{1}{(z+ai)^3} \exp(-1/2\times \mathrm{Log}(z))
\\ + \mathrm{Log}(z) \frac{1}{(z+ai)^2} 
\exp(-1/2\times \mathrm{Log}(z)) \times -\frac{1}{2} \frac{1}{z}.$$
With the branch of the logarithm we find $\mathrm{Log}(ai) =
\log a + \pi i/2$, getting
$$\frac{1}{\sqrt{a}} \exp(-\pi i/4)
\\ \times \left(\frac{1}{ai} \times - \frac{1}{4 a^2}
+ (2\log a + \pi i) \frac{1}{8 i a^3}
+ (\log a + \pi i/2) \times - \frac{1}{4 a^2} 
\times -\frac{1}{2 ai}\right)
\\ = \frac{1}{\sqrt{a}} \exp(-\pi i/4) \frac{1}{8i a^3}
(3\log a + 3\pi i/2 - 2).$$
We also have $\mathrm{Log}(-ai) = \log a + 3 \pi i/2$, getting
for the second residue at $z=-ai$
$$\frac{1}{\sqrt{a}} \exp(-3\pi i/4)
\\ \times \left(- \frac{1}{ai} \times - \frac{1}{4 a^2}
- (2\log a + 3\pi i) \frac{1}{8 i a^3}
+ (\log a + 3\pi i/2) \times - \frac{1}{4 a^2} 
\times \frac{1}{2 ai}\right)
\\ = \frac{1}{\sqrt{a}} \exp(-3\pi i/4) \frac{1}{8i a^3}
(- 3\log a - 9\pi i/2 + 2).$$
With $\exp(-\pi i/4) = 
\frac{\sqrt{2}}{2} - i \frac{\sqrt{2}}{2}$
and $\exp(-3\pi i/4) = 
-\frac{\sqrt{2}}{2} - i \frac{\sqrt{2}}{2}$
and factoring out $\frac{1}{\sqrt{a}} \frac{1}{8i a^3}$
we get three contributions, which are
$$\sqrt{2} (3\log a - 2) + 3\pi i (\sqrt{2} + i\sqrt{2}/2)$$
Combine these and multiply by $\pi i$ to get
$$\frac{\pi}{8\sqrt{a} a^3}
(\sqrt{2} (3\log a - 2) + 3\pi i (\sqrt{2} + i\sqrt{2}/2)).$$
We extract the real part as promised and obtain
$$\frac{\sqrt{2}\pi}{8\sqrt{a} a^3}
(3\log a - 2 - 3\pi/2)$$
or
$$\bbox[5px,border:2px solid #00A000]{
\frac{\pi}{4\sqrt{2} a^{7/2}}
\left(3\log a - 2 - \frac{3}{2}\pi\right).}$$
matching the result by @Jack D'Aurizio.
As a bonus we have shown that
$$\int_0^\infty \frac{1}{\sqrt{x} (x^2+a^2)^2} dx
= \frac{1}{\pi} \frac{\pi}{8\sqrt{a} a^3} 3\sqrt{2}\pi 
= \frac{3\pi}{4\sqrt{2} a^{7/2}}.$$
