How does one show that $\lim_{n\to\infty}\ln{n}-\int_{0}^{n}{e^x-x-1\over x(e^x+1)}=\ln{\pi}-\gamma$ Consider

$$\lim_{n\to\infty}\ln{n}-\int_{0}^{n}{e^x-x-1\over x(e^x+1)}=\ln{\pi}-\gamma\tag1$$

How does one show that?

Wolfram integrator can't evaluate the indefinite integral $(1)$
 A: Write
\begin{align*}
\int_{0}^{n} \frac{e^x - x - 1}{x(e^x + 1)} \, dx
&= \int_{0}^{n} \frac{e^x - 1}{e^x + 1} \frac{dx}{x} - \int_{0}^{n} \frac{dx}{e^x + 1} \\
&= \left[ \frac{e^x - 1}{e^x + 1} \log x \right]_{0}^{n} - \int_{0}^{n} \frac{2e^x}{(e^x + 1)^2} \log x \, dx + \left[ \log(1 + e^{-x}) \right]_{0}^{n} \\
&= \frac{e^n - 1}{e^n + 1} \log n + \log\left( \frac{1 + e^{-n}}{2} \right) - \int_{0}^{n} \frac{2e^x}{(e^x + 1)^2} \log x \, dx.
\end{align*}
From this, we have
$$ \lim_{n\to\infty}\left( \log n - \int_{0}^{n} \frac{e^x - x - 1}{x(e^x + 1)} \, dx \right) = \int_{0}^{\infty} \frac{2e^x}{(e^x + 1)^2} \log x \, dx + \log 2. $$
In order to evaluate the last integral, we adopt the Feynman's trick. Specifically, we introduce the following function
$$ I(s) = \int_{0}^{\infty} \frac{2e^x}{(e^x + 1)^2} x^s \, dx. $$
The value we are interested in is $I'(0)$. In order to compute this, assume first that $\Re(s) > 1$ and we perform the following computation:
\begin{align*}
I(s)
&= 2 \sum_{n=1}^{\infty} (-1)^{n-1} n \int_{0}^{\infty} x^s e^{-nx} \, dx \\
&= 2\Gamma(s+1) \sum_{n=1}^{\infty} \frac{(-1)^{n-1}}{n^s} \\
&= 2\Gamma(s+1)(1 - 2^{1-s})\zeta(s).
\end{align*}
(The assumption $\Re(s) > 1$ is essential when applying the Fubini's theorem.) Since both $I(s)$ and $2\Gamma(s+1)(1 - 2^{1-s})\zeta(s)$ are analytic for $\Re(s) > -1$, by the principle of analytic continuation the identity above extends to $\Re(s) > -1$. Thus by the log-differentiation together with known values 
$$\zeta(0) = -\frac{1}{2}, \qquad \zeta'(0) = -\frac{1}{2}\log(2\pi), \qquad \psi(1) = -\gamma$$
(where $\psi$ is the digamma function), we obtain
$$ I'(0) = -\gamma - 2\log 2 + \log(2\pi). $$
Plugging this back, we obtain the desired equality.
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}$

Note that

\begin{align}
&\lim_{n\to\infty}\bracks{\ln\pars{n} -
\int_{0}^{n}{\expo{x} - x - 1 \over x\pars{\expo{x} + 1}}\,\dd x}
\\[5mm] = &\
\lim_{n\to\infty}\bracks{\ln\pars{n} -
\int_{0}^{n}{1 - \expo{-x} \over 1 + \expo{-x}}\,{\dd x \over x}\ +\
\overbrace{\int_{0}^{n}{\dd x \over \expo{x} + 1}}
^{\ds{\ln\pars{2} - \ln\pars{1 + \expo{-n}}}}}
\\[5mm] = &\
\lim_{n \to \infty}\bracks{%
\ln\pars{2n \over 1 + \expo{-n}} - \pars{%
\int_{0}^{n}{1 - \expo{-x} \over 1 + \expo{-x}}\,{\dd x \over x} -
\int_{0}^{n}{1 - \expo{-x} \over x}\,\dd x} -
\int_{0}^{n}{1 - \expo{-x} \over x}\,\dd x}
\\[5mm] & =
\lim_{n \to \infty}\braces{%
\ln\pars{2n \over 1 + \expo{-n}} + 
\int_{0}^{n}\!\!{\expo{-x} - \expo{-2x} \over 1 + \expo{-x}}\,{\dd x \over x} -
\bracks{\ln\pars{n}\pars{1 - \expo{-n}} -
\int_{0}^{n}\!\!\!\!\ln\pars{x}\expo{-x}\,\dd x}}
\\[5mm] = &\
\ln\pars{2}\ +\
\underbrace{\int_{0}^{\infty}{\expo{-x} - \expo{-2x} \over 1 + \expo{-x}}
\,{\dd x \over x}}_{\ds{\ln\pars{\pi \over 2}}}\ +\
\underbrace{\int_{0}^{\infty}\ln\pars{x}\expo{-x}\,\dd x}_{\ds{-\gamma}} =
\bbx{\ds{\ln\pars{\pi} - \gamma}}
\end{align}

Note that
  $\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}$.


The remaining integral is evaluated as follows:
\begin{align}
&\bbx{\ds{%
\int_{0}^{\infty}{\expo{-x} - \expo{-2x} \over 1 + \expo{-x}}\,{\dd x \over x}}} =
\int_{0}^{\infty}{\expo{-3x} - 2\expo{-2x} + \expo{-x} \over 1 - \expo{-2x}}\,{\dd x \over x}
\\[5mm] \stackrel{\expo{-2x}\ \mapsto\ x}{=}\,\,\,&
-\int_{0}^{1}{x^{1/2} - 2 + x^{-1/2} \over 1 - x}\,{\dd x \over \ln\pars{x}} =
-\int_{0}^{1}{x^{1/2} - 2 + x^{-1/2} \over 1 - x}
\pars{-\int_{0}^{\infty}x^{t}\,\dd t}\,\dd x
\\[5mm] = &\
\int_{0}^{\infty}\int_{0}^{1}
{x^{t + 1/2} - 2x^{t} + x^{t - 1/2} \over 1 - x}\,\dd x\,\dd t
\\[5mm] = &\
\int_{0}^{\infty}\bracks{%
-\int_{0}^{1}{1 - x^{t + 1/2} \over 1 - x}\,\dd x +
2\int_{0}^{1}{1 - x^{t} \over 1 - x}\,\dd x -
\int_{0}^{1}{1 - x^{t - 1/2} \over 1 - x}\,\dd x}\,\dd t
\\[5mm] = &\
\int_{0}^{\infty}\bracks{-\Psi\pars{t + {3 \over 2}} +
2\Psi\pars{t + 1} - \Psi\pars{t + {1 \over 2}}}\dd t
\\[5mm] = &\
\left.-\ln\pars{\Gamma\pars{t + 3/2}\Gamma\pars{t + 1/2} \over
\Gamma^{2}\pars{t + 1}}\right\vert_{\ t\ =\ 0}^{\ t\ \to\ \infty} =
\ln\pars{\Gamma\pars{3/2}\Gamma\pars{1/2} \over \Gamma^{2}\pars{1}} =
\ln\pars{{1 \over 2}\,\Gamma^{2}\pars{1 \over 2}}
\\[5mm] = &\
\bbx{\ds{\ln\pars{\pi \over 2}}}
\end{align}
