I want to calculate
$$\int_0^\infty \frac{\ln x}{x^2+4}\,dx$$
using the Residue Theorem. The contour I want to use is almost the upper half circle of radius $R$, but going around $0$ following a half-circle of radius $\epsilon$, and using the branch cut at $3\pi/2$. The picture is below. Let's call the left segment $L_1$ and the right one $L_2$.
I can show that $\int_{C_R}\frac{\log z}{z^2+4} = 0.$ I don't know what to do about $\int_{C_\epsilon}\frac{\log z}{z^2+4}$. I've got
$$ \begin{align} \left|\int_{C_\epsilon}\frac{\log z}{z^2+4}\,dz\right| &=\left|-\int_{-C_\epsilon}\frac{\log z}{z^2+4}\,dz\right|\\ &=\left|\int_{0}^\pi\frac{\log(\epsilon e^{it})}{\epsilon^2e^{2it}+4}\cdot i\epsilon e^{it}\,dt\right|\\ &\le\int_{0}^\pi\left|\frac{\log(\epsilon e^{it})}{\epsilon^2e^{2it}+4}\cdot i\epsilon e^{it}\right|\,dt\\ &\le\int_{0}^\pi\left|\frac{\log(\epsilon e^{it})}{\epsilon^2e^{2it}+4}\cdot i\epsilon e^{it}\right|\,dt\\ &\le\int_{0}^\pi\left|\frac{\log(\epsilon e^{it})}{4}\cdot i\epsilon e^{it}\right|\,dt\\ &=\int_{0}^\pi\frac{\left|\ln \epsilon + it\right|}{4}\cdot \epsilon\,dt \end{align} $$
Edit
But this goes to $\infty$ as $\epsilon$ goes to $0$. Am I doing something wrong, or is there another way to get a better estimate that goes to $0$? I also don't understand how the branch cut plays a role, as long as we picked something that didn't intersect the contour.
(I've changed the calculation to reflect the comment.) I see that this goes to $0$. Using the residue theorem to calculate the integral over the whole contour, I get
$$ \begin{align} 2\pi i\text{Res}_{2i} \frac{\log z}{z^2+4} &=\left. 2\pi i\frac{log z}{2z}\right|_{z=2i}\\ &=2\pi i\cdot\frac{log(2i)}{4i}\\ &=\frac{ln 2 + i\frac{\pi}{2}}{4i}\\ &=\frac{\pi}{2}\left(\ln 2 + i\frac{\pi}{2}\right). \end{align} $$
Since
$$\int_{L_1} f(z) + \int_{L_2} f(z) \to \int_{-\infty}^{\infty}\frac{\ln x}{x^2+4}, $$ I almost have what I want. But what about that $i\pi/2$?