Alternative approaches to showing that $\gamma=\int_0^\infty \left(\frac{1}{1+x^a}-\frac{1}{e^x}\right)\,\frac1x\,dx$, $a>0$ Starting from the limit definition of the Euler-Mascheroni constant $\gamma$ as given by

$$\gamma=\lim_{n\to \infty}\left(-\log(n)+\sum_{k=1}^n\frac1k\right)\tag 1$$

we can show that $\gamma$ has an integral representation

$$\gamma=\int_0^\infty\left(\frac{1}{e^x-1}-\frac{1}{xe^x}\right)\,dx \tag 2$$



Proof of $(2)$:  This is provided for completeness only and one can skip this part without losing context.

To show that the integral in $(2)$ is equivalent to $(1)$, we can proceed as follows.
$$\begin{align}
\int_0^\infty\left(\frac{1}{e^x-1}-\frac{1}{xe^x}\right)\,dx&=
\int_0^\infty \frac{e^{-x}}{1-e^{-x}}\left(1-\frac{1-e^{-x}}{x}\right)\,dx\\\\
&=\sum_{k=1}^\infty \int_0^\infty\left(e^{-kx}-\frac{e^{-kx}-e^{-(k+1)x}}{x}\right)\,dx\\\\
&=\sum_{k=1}^\infty \left(\frac{1}{k}-\log\left(\frac{k+1}{k}\right)\right)\\\\
&=\lim_{n\to \infty}\sum_{k=1}^n \left(\frac1k -\log\left(\frac{k+1}{k}\right)\right)\\\\
&=\lim_{n\to \infty}\left(-\log(n+1)+\sum_{k=1}^n\frac1k\right)\\\\
&=\lim_{n\to \infty}\left(-\log(n)+\sum_{k=1}^n\frac1k\right)\\\\
\end{align}$$

Another integral representation for $\gamma$ is given by

$$\gamma=\int_0^\infty \left(\frac{1}{x(1+x^a)}-\frac{1}{xe^x}\right) \,dx \tag 3$$

for $a>0$.
Equipped with $(2)$, we can show the equivalence of $(3)$ with $(1)$ by showing that

$$\int_0^\infty \left(\frac{1}{x(1+x^a)}-\frac{1}{e^x-1}\right)\,dx=0\tag 4$$


To prove $(4)$, I proceeded as follows.
$$\begin{align}
\lim_{\epsilon\to 0^+}\int_{\epsilon}^\infty\left(\frac{1}{x(1+x^a)}-\frac{1}{e^x-1}\right)\,dx &=\lim_{\epsilon\to 0^+}\left.\left(-\frac1a \log(1+x^{-a})-\log(1-e^{-x})\right)\right|_{\epsilon}^{\infty}\\\\
&=\lim_{\epsilon\to 0^+}\left(\frac1a \log(1+\epsilon^{-a})+\log(1-e^{-\epsilon})\right)\\\\
&=0
\end{align}$$
And we are done!

This approach seemed a bit cumbersome and indirect.

QUESTION: So, what are alternative approaches to establishing equivalence of $(3)$ and $(1)$?

 A: Integrating by parts,
$$ \int_0^{\infty} \left( \frac{1}{1+x^a}  - e^{-x} \right) \frac{dx}{x} = 0-0 + \int_0^{\infty} \left( \frac{ax^a}{x(1+x^a)^2} - e^{-x} \right) \log{x} \, dx $$
Of course, we recognise the second term as a familiar definition of/easy-to-derive formula for $\gamma$. The first term we need to show is zero. But
$$ \int \frac{ax^a\log{x}}{x(1+x^a)^2} \, dx = \frac{x^a\log{x}}{1+x^a} - \frac{1}{a}\log{(1+x^a)}, $$
which is continuous and tends to zero at both endpoints since $a>0$.

The really interesting thing about this result in my opinion is that it shows the first term is a complete red herring: let $F$ be continuous and continuously differentiable on $(0,\infty)$ with the following properties:


*

*$ F(x) = 1 + o(1/\log{x})$ as $x \downarrow 0 $,

*$F(x) = o(x^{-\epsilon})$ as $x \uparrow \infty$ for some $\epsilon>0$,

*$\int_0^{\infty} F'(x) \log{x} \, dx = 0$


Then
$$ \gamma = \int_0^{\infty} \left( F(x) -  e^{-x} \right) \frac{dx}{x}. $$
The proof is essentially identical to the above:
$$ \int_0^{\infty} ( F(x)  - e^{-x} ) \frac{dx}{x} = [(F(x) - e^{-x}) \log{x}]_0^{\infty} - \int_0^{\infty} ( F'(x) + e^{-x} ) \log{x} \, dx = \int_0^{\infty} e^{-x} \log{x} \, dx, $$
The integral on the left exists by the first two conditions on $F$, which are also enough to ensure the boundary terms from the integration by parts go to zero.
A: 
I thought it might be instructive to present a supplement to the nice solution posted by @Chappers in order to have a self-contained way forward.  To that end, we proceed.


In THIS ANSWER, I showed using the integral representation of the Gamma function
$$\Gamma(x)=\int_0^\infty s^{x-1}e^{-s}\,ds \tag 1$$
that Gamma can be expressed as the limit
$$\Gamma(x)=\lim_{n\to \infty}\frac{n^x\,n!}{x(x+1)(x+2)\cdots (x+n)} \tag 2$$
Now, note that $(2)$ can be rewritten as 
$$\begin{align}
\Gamma(x)&=\lim_{n\to \infty}\frac{e^{x(\log(n)-1-1/2-\cdots -1/n)}\, e^{x}e^{x/2}\cdots e^{x/n}}{x(1+x)(1+x/2)\cdots (1+x/n)} \\\\&=\frac{e^{-\gamma x}}{x}\prod_{n=1}^\infty e^{x/n}\left(1+\frac xn\right)^{-1}\tag 3
\end{align}$$
where $(3)$ gives the well-known Weierstrass product for Gamma.  
Differentiating the logarithm of $(3)$ and setting $x=1$ reveals
$$\Gamma'(1)=\Gamma(1)\left(-\gamma -1+\sum_{n=1}^\infty \left(\frac1n-\frac{1}{n+1}\right)\right)=-\gamma \tag 4$$
Differentiating $(1)$ and setting $x=1$ yields
$$\Gamma'(1)=\int_0^\infty \log(x)e^{-x}\,dx \tag 5$$
whence comparing $(4)$ and $(5)$ we obtain the coveted result
$$\int_0^\infty \log(x)e^{-x}\,dx =-\gamma$$

In THIS ANSWER, I showed that that $\gamma$ as given by $\gamma=-\int_0^\infty e^{-x}\,\log(x)\,dx$ is equal to $\gamma$ as expressed by the limit $\gamma=\lim_{n\to \infty}\left(-\log(n)+\sum_{k=1}^n\frac1k\right)$.
A: The same idea as in my previous answer applies. Notice that
$$ f(x) = \frac{1}{1+x} \quad \Rightarrow \quad \int_{\epsilon}^{\infty} \frac{f(x)}{x} \, dx = -\log\epsilon + \log(1+\epsilon) = -\log\epsilon + o(1) $$
as $\epsilon \to 0^+$. Now from the linked answer above, we find that
\begin{align*}
f(x) = e^{-x}
&\quad \Rightarrow \quad c(f) = \lim_{R\to\infty} \left( \int_{0}^{R} \frac{ds}{1+s} - \log R \right) - \gamma = -\gamma \\
&\quad \Rightarrow \quad \int_{\epsilon}^{\infty} \frac{e^{-x}}{x} \, dx = -\log\epsilon - \gamma + o(1).
\end{align*}
It is worth to remark that the $\gamma$ term above is computed from the identity $\gamma = -\int_{0}^{\infty} e^{-x}\log x \, dx$, which you are already aware of. From this,
\begin{align*}
\int_{\epsilon}^{\infty} \frac{1}{x^a + 1} \, \frac{dx}{x} - \int_{\epsilon}^{\infty} e^{-x} \, \frac{dx}{x}
&= \frac{1}{a}\int_{\epsilon^a}^{\infty} \frac{1}{x + 1} \, \frac{dx}{x} - \int_{\epsilon}^{\infty} e^{-x} \, \frac{dx}{x}\\
&= \gamma + o(1)
\end{align*}
and taking $\epsilon \to 0^+$ gives the result.

Using the quantity $c(f)$, you can compute various integrals (including all the integrals you have asked) together with some tabulated results for $c(f)$:
\begin{align*}
c\left\{\frac{1}{(1+x)^\alpha}\right\} &= -H_{\alpha-1}, &
c\{e^{-x}\} &= -\gamma, \\
c\left\{\frac{x}{e^x-1}\right\} &= 0, &
c\{\cos x\} &= -\gamma,
\end{align*}
where $H_n$ is the harmonic numbers. For instance, if $a > 0$ then
\begin{align*}
\int_{0}^{\infty} \left( \frac{1}{\sqrt{1+a x}} - e^{-x^2} \right) \frac{dx}{x}
&= c\left\{ \frac{1}{\sqrt{1+a x}} - e^{-x^2} \right\} \\
&= c\left\{ \frac{1}{\sqrt{1+a x}} \right\} - c\{e^{-x^2}\} \\
&= c\left\{ \frac{1}{\sqrt{1+x}} \right\} - \log a - \frac{1}{2}c\{e^{-x}\} \\
&= H_{-1/2} - \log a + \frac{\gamma}{2} \\
&= \frac{\gamma}{2} - \log(4a).
\end{align*}
A: $\newcommand{\bbx}[1]{\,\bbox[8px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
&\left.\int_{0}^{\infty}\pars{{1 \over 1 + x^{a}} - {1 \over \expo{x}}}
\,{\dd x \over x}\,\right\vert_{\ a\ >\ 0} =
\lim_{\epsilon \to 0^{+}}\pars{%
\int_{\epsilon}^{\infty}{\dd x \over \pars{1 + x^{a}}x}  -
\int_{\epsilon}^{\infty}{\expo{-x} \over x}\,\dd x}
\\[5mm] = &\
\lim_{\epsilon \to 0^{+}}\braces{%
{1 \over a}\int_{\epsilon^{a}}^{\infty}{\dd x \over \pars{1 + x}x}  - \bracks{-\ln\pars{\epsilon}\expo{-\epsilon} +
\int_{\epsilon}^{\infty}\ln\pars{x}\expo{-x}\,\dd x}}
\\[5mm] = &\
\gamma +
\lim_{\epsilon \to 0^{+}}\bracks{%
-{1 \over a}\ln\pars{\epsilon^{a} \over 1 + \epsilon^{a}}   +
\ln\pars{\epsilon}\expo{-\epsilon}}\label{1}\tag{1}
\end{align}

because
  $\ds{\int_{0}^{\infty}\ln\pars{x}\expo{-x}\,\dd x =
\left.\totald{}{\mu}\int_{0}^{\infty}x^{\mu}\expo{-x}\,\dd x
\,\right\vert_{\ \mu\ =\ 0} =
\left.\totald{\Gamma\pars{\mu + 1}}{\mu}
\,\right\vert_{\ \mu\ =\ 0} =\Psi\pars{1} = -\gamma}$.

Expression \eqref{1} becomes:
\begin{align}
&\left.\int_{0}^{\infty}\pars{{1 \over 1 + x^{a}} - {1 \over \expo{x}}}
\,{\dd x \over x}\,\right\vert_{\ a\ >\ 0} =
\gamma\ +\
\underbrace{\lim_{\epsilon \to 0^{+}}\bracks{%
{1 \over a}\ln\pars{1 + \epsilon^{a}} -
\ln\pars{\epsilon}\pars{1 - \expo{-\epsilon}}}}_{\ds{=\ 0}}\ =\
\bbox[15px,#ffe,border:1px dotted navy]{\ds{\gamma}}
\end{align}
