Why does $\int_0^\infty\frac{\ln (1+x)}{\ln^2(x)+\pi^2}\frac{dx}{x^2}$ give the Euler-Mascheroni constant? I'd like to see the reason why $$\int\limits_{0}^{\infty}\frac{\mathrm{ln}(1+x)}{\mathrm{ln}^2(x)+\pi^2}\frac{\mathrm{d}x}{x^2}=\gamma$$
where $\gamma$ is the Euler-Mascheroni constant.
I don't have any 'neat tricks' for this expression... would appreciate any!
 A: From the standard integral representation of the Euler-Mascheroni constant we have:
$$ \gamma = \int_{0}^{1}\left(\frac{1}{\log(1-x)}+\frac{1}{x}\right)\,dx \tag{1}$$
hence if we define the Gregory coefficients $C_n$ through the Taylor series of $\frac{z}{\log(1-z)}$ in a neighbourhood of zero:
$$ \frac{z}{\log(1-z)}=\sum_{n\geq 0}C_n\,x^n \tag{2}$$
we have $C_0=-1$ and 
$$\gamma = \sum_{n\geq 1}\frac{C_n}{n}.\tag{3}$$
By the Cauchy integral formula and the residue theorem it follows from $(2)$ that the Gregory coefficients have the following integral representation:
$$\forall n\geq 1,\quad C_n=\int_{0}^{+\infty}\frac{dx}{(1+x)^n(\pi^2+\log^2 x)}\tag{4}$$
so by exploiting $(3)$ and the identity:
$$\forall x>0,\quad \sum_{n\geq 1}\frac{1}{n(1+x)^n} = \log\frac{x+1}{x}\tag{5}$$
it follows that:
$$\gamma = \int_{0}^{+\infty}\frac{\log(x+1)-\log x}{\pi^2+\log^2 x}\,dx \tag{6}$$ 
and the proof is complete by mapping $x$ into $\frac{1}{x}$ in the last integral.
A: Here is an approach.
We may observe that we have

$$
\int_0^{+\infty}\frac 1{(x+t)(\log^2 x +\pi^2)}dx=\frac 1{\log t}+\frac 1{1-t},\quad 0<t<1.\tag1
$$

Proof. Let $t$ be any real number such that $0<t<1$. Set
$$
f(z):=\frac 1{(z+t)(\log z +i\pi)}
$$ where $\log$ is the determination of the logarithm defined on the complex plane cut along the positive real axis. Consider
$$\oint_{C}  f(z)\: dz$$
where $C$ is a keyhole contour of radius $R$ about the positive real axis, that has four components, consisting of a small semi-circle $\Gamma_\epsilon$ about the origin of radius $\epsilon$, a line segment $L^+$ above the positive real axis close to it, an almost full circle $\Gamma_R$ and a line segment $L^-$ below and parallel to the positive real axis in the negative sense. Then
$$\oint_{C}  f(z)\: dz=\int_{\large \Gamma_\epsilon} f(z)\:dz +\int_{\large L^+} f(z)\:dz+ \int_{\large \Gamma_R} f(z)\:dz+\int_{\large L^-} f(z)\:dz$$ 
As $\epsilon \to 0$, the first integral vanishes because the integrand is $\mathcal{O}\Big(\dfrac \epsilon {\log \epsilon}\Big)$ uniformly on the compact set $[-\pi/2,\pi/2]$; as $R \to +\infty$, the third integral vanishes because the integrand is $\mathcal{O}\Big(\dfrac 1 {\log R}\Big)$ uniformly on the compact set $[0,2\pi]$. 
Thus, as $\epsilon \to 0$ and as $R \to +\infty$, the contour integral is equal to
$$
\int_0^{+\infty}\frac{1}{x+t}\left(-\frac 1{\log x +i \pi}+\frac 1{\log x -i \pi}\right)dx=
2i\pi \int_0^{+\infty}\frac 1{(x+t)(\log^2 x +\pi^2)}dx.$$
By the residue theorem, the contour integral is also equal to $2 i \pi$ times the sum of the residues at the poles $z=-t$, $z=-1$: 
$$\begin{align}
\text{Res}_{\large z=-t}(f):&=\lim_{z\to -t}\,(z+t)f(z)=\frac 1{\log t}\\
\text{Res}_{\large z=-1}(f):&=\lim_{z\to -1}\,(z+1)f(z)=\frac 1{1-t}
\end{align}
$$
giving 
$$
2i\pi \int_0^{+\infty}\frac 1{(x+t)(\log^2 x +\pi^2)}dx=2i\pi \Big( \frac 1{\log t}+\frac 1{1-t}\Big)
$$
which is $(1)$.
Then, integrating both sides of $(1)$ with respect to $t$ from $0$ to $1$, we get on the left hand side, using Fubini's theorem applied to positive integrands: 
$$
\int_{0}^{\infty}\frac{\log(1+1/x)}{\log^2 x+\pi^2}dx\stackrel{\large x\to1/x}=\int_{0}^{\infty}\frac{\log(1+x)}{\log^2 x+\pi^2}\frac{dx}{x^2} \tag2
$$
and we get on the right hand side the classic integral

$$
\int_0^{1}\left(\frac 1{\log t}+\frac 1{1-t}\right)dt= \gamma, \tag3
$$

leading to the desired result.
