TITLE: How to integrate $\int\frac{\ln x\,dx}{x^2+2x+4}$
QUESTION [8 upvotes]: $$K=\int\frac{\ln x\,dx}{x^2+2x+4}$$


I did this $x^2+2x+4=(x+\alpha)(x+\beta)$, then used partial fraction, I am then unsure how to integrate $\int\frac{\ln x}{x+c}\,dx$.
I tried Integration by parts also taking first function as both of them which ended nowhere
Also I need help how to evaluate this, with or without(which I think might be easier) using the above:

$$I=\int_0^{\infty}\frac{\ln x\,dx}{x^2+2x+4}$$


I did $x\mapsto 1/x$and then added those to get:
$$I=\frac32\int_0^{\infty}\frac{(x^2-1)\ln x \,dx}{(x^2+2x+4)(4x^2+2x+1)}=?$$

REPLY [3 votes]: One way to attack improper integrals of the form 
$$\int_0^{\infty} dx \, f(x) $$
is to use the residue theorem, i.e. contour integration in the complex plane.  To do this, one considers the contour integral
$$\oint_C dz \, f(z) \log{z} $$
where $C$ is a keyhole contour about the positive real axis, of inner radius $\epsilon$ and outer radius $R$.  We consider the limits as $\epsilon \to 0$ and $R \to \infty$.  In most cases, the integrals about the inner and outer circles vanish in these limits (I will not prove here).  
In this case, our statement of the residue theorem takes the form
$$\int_0^{\infty} dx \frac{\log^2{x} - (\log{x}+i 2 \pi)^2}{x^2+2 x+4} = i 2 \pi \sum_{k=1}^2\frac{\log^2{z_k}}{2 z_k+2}$$
where $z_{1,2}= -1 \pm i \sqrt{3}$, or, in other words, $z_1 = 2 e^{i 2 \pi/3}$ and $z_2=2 e^{i 4 \pi/3}$.  Note that the arguments of the $z_k$ are between $[0,2 \pi]$ necessarily because of how $C$ was defined.  Thus,
$$-i 4 \pi \int_0^{\infty} dx \frac{\log{x}}{x^2+2 x+4} + 4 \pi^2 \int_0^{\infty} dx \frac{1}{x^2+2 x+4} = i 2 \pi \left [\frac{(\log{2} + i 2 \pi/3)^2}{i 2 \sqrt{3}} + \frac{(\log{2} + i 4 \pi/3)^2}{-i 2 \sqrt{3}} \right ]$$
Equating real and imaginary parts, we find that
$$\int_0^{\infty} dx \frac{1}{x^2+2 x+4} = \frac{\pi}{\sqrt{3}} $$
$$\int_0^{\infty} dx \frac{\log{x}}{x^2+2 x+4} = \frac{\pi}{ 3 \sqrt{3}} \log{2}$$