Stuck at this definite integration: $\int_ {0} ^ {\infty} \frac {\log(x)} {x^2 + 2x + 4} \, \mathrm dx$ 
If $$\int_ {0} ^ {\infty} \frac {\log(x)} {x^2 + 2x + 4} \, \mathrm dx \ $$ is equal
to $\pi \ln p/ \sqrt {q} \ $, where $p$ and $q$ are coprimes, then
what is the value of $p + q$?

Ok, so I am stuck with this problem. It was in my exam. The question was a very long one. After solving and simplifying, I was stuck with this definite integration.
The options were $27$ and $29$. I had no idea how to proceed further.
I tried substituting various things, such as $x+1$ to $\tan A$ etc., but nothing seems to work. I hope someone can help shed some light on the problem.
If you want the full question, comment and I will post it.
 A: Jack has already covered the simple, real analysis way of evaluating this integral. So if anybody's curious, here's a way to solve your integral using complex analysis. Note that for these kinds of integral, contour integration is a bit overkill.
The function under consideration is$$f(z)=\frac 1{z^2+2z+4}$$And we are integrating $f(z)$ over the contour $\mathrm C$: a keyhole contour as pictured below.

We define the argument above the real axis to be zero and the argument below to be $2\pi$. Therefore, above we have $z=x$ while below gives $z=xe^{2\pi i}$. We also parametrize about the contour in four different sections. First, a large circle of radius $R$, a smaller circular detour about the origin of radius $\epsilon$, and $\Gamma_{R}$ and $\gamma_{\epsilon}$ arcs respectively. Hence, we get$$\begin{multline}\oint\limits_{\mathrm C}dz\, f(z)\log^2z=\int\limits_{\epsilon}^{R}dx\, f(x)\log^2x+\int\limits_{\Gamma_{R}}dz\, f(z)\log^2z\\-\int\limits_{\epsilon}^{R}dx\, f(x)\left(\log|x|+2\pi i\right)^2+\int\limits_{\gamma_{\epsilon}}dx\, f(x)\log^2x\end{multline}$$As $R\to\infty$ and $\epsilon\to0$, the second and fourth integrals vanish. This can be shown by substituting $z=Re^{i\theta}$ and $z=\epsilon e^{i\theta}$ into the arcs respectively and taking the limits. Hence, all we're left with is$$\oint\limits_{\mathrm C}dz\, f(z)\log^2z=-4\pi i\int\limits_0^{\infty}dx\, f(x)\log x+4\pi^2\int\limits_0^{\infty}dx\, f(x)$$Our contour integral, by the residue theorem, is also equal to $2\pi i$ times the sum of the residues inside the contour. We only have two poles: $z=-1\pm i\sqrt3$ so the residues are$$\begin{align*}z_{+} & =\operatorname*{Res}_{z\, =\, -1+i\sqrt3}\,\frac {\log^2z}{z^2+2z+4}=\lim\limits_{z\to-1+i\sqrt3}\frac {\log^2z}{z+1+i\sqrt3}=\frac {9\log^22+12\pi i\log 2-4\pi^2}{18i\sqrt3}\\\\z_{-} & =\operatorname*{Res}_{z\, =\, -1-i\sqrt3}\,\frac {\log^2z}{z^2+2z+4}=\lim\limits_{z\to-1-i\sqrt3}\frac {\log^2z}{z+1-i\sqrt3}=-\frac {9\log^22+24\pi i\log 2-16\pi^2}{18i\sqrt3}\end{align*}$$Hence, by the residue theorem,$$\begin{align*}\oint\limits_{\mathrm C}dz\, f(z)\log^2z & =2\pi i\left(z_{+}+z_{-}\right)\\ & =\frac {4\pi^3}{3\sqrt3}-\frac {4\pi^2i\log2}{3\sqrt3}\end{align*}$$Taking the imaginay portion and dividing by $-4\pi$, we get$$\int\limits_0^{\infty}dx\, \frac {\log x}{x^2+2x+4}=\frac {\pi\log 2}{3\sqrt3}$$
A: The hidden trick is that $\int_{0}^{+\infty}\frac{\log(x)}{q(x)}\,dx = 0$ for any quadratic and palindromic polynomial $q(x)$, by the substitution $x\mapsto\frac{1}{x}$. So, if in the original integral we set $x=2y$ we get
$$ \mathcal{I}=\int_{0}^{+\infty}\frac{\log(x)\,dx}{x^2+2x+4} = 2\int_{0}^{+\infty}\frac{\log(2)+\log(y)}{4y^2+4y+4}\,dy = 2\log(2) \int_{0}^{+\infty}\frac{dy}{(2y+1)^2+3} $$
and $\mathcal{I}=\frac{\pi\log(2)}{3\sqrt{3}}$ is a straightforward consequence.
