Integral of $\ln(\tanh(x))$

By applying the definition of the hyperbolic tangent function in terms of the exponential we obtain

$$\begin{align} \int_0^{\infty}\log(\tanh(x))dx&=\int_0^{\infty}\log\left(\frac{e^x-e^{-x}}{e^x+e^{-x}}\right)dx \\ &=\int_0^{\infty}\log\left(\frac{1-e^{-2x}}{1+e^{-2x}}\right)dx\\ &=\int_0^{\infty}\log\left(1-e^{-2x}\right)-\log\left(1+e^{-2x}\right)dx \end{align}$$

Now by expanding the logarithm as a series $($!$)$ we further get

$$\begin{align} \int_0^{\infty}\log\left(1-e^{-2x}\right)-\log\left(1+e^{-2x}\right)dx&=\int_0^{\infty}-\sum_{n=1}^{\infty}\frac1{n}e^{-2nx}+\sum_{n=1}^{\infty}\frac{(-1)^n}{n}e^{-2nx}dx\\ &=-\sum_{n=1}^{\infty}\left[-\frac{e^{-2nx}}{2n^2}\right]_0^{\infty}+\sum_{n=1}^{\infty}\left[(-1)^{n+1}\frac{e^{-2nx}}{2n^2}\right]_0^{\infty}\\ &=-\sum_{n=1}^{\infty}\frac1{2n^2}-\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{2n^2}\\ &=-\frac12\zeta(2)-\frac12\eta(2)\\ &=-\frac12\frac{\pi^2}6-\frac12\frac{\pi^2}{12}\\ &=-\frac{\pi^2}8 \end{align}$$

Which is the desired result. $\zeta(s)$ denotes the Riemann Zeta Function and $\eta(s)$ the Dirichlet Eta Function respectively for which the values are known.

Anyway this solution is kind of unsteady since I cannot really justify the validity of the power series of the logarithmic functions $($which is normally restricted to $|x|<1$ $)$ nor the termwise integration. Nevertheless it leads to the right solution.


EDIT:

As illustrated by ComplexYetTrivial within the comments the validity of the series expansion of the logarithm is guaranteed due the the fact that $e^{-2x}<1$ for all $x>0$ from where the series converges. Whereas the termwise integration is justified by the monotone dominate convergence theorem. Thus my proposed solution seems to be entirely fine.


Through the substitution $x=\text{arctanh}(t)$ we have $I=\int_{0}^{+\infty}\log\tanh x\,dx = \int_{0}^{1}\frac{\log t}{1-t^2}\,dt$.
Since $\int_{0}^{1}t^{2n}\log(t)\,dt = -\frac{1}{(2n+1)^2}$ we have

$$ I = -\sum_{n\geq 0}\frac{1}{(2n+1)^2}=-\left[\zeta(2)-\frac{1}{4}\zeta(2)\right]=-\frac{3}{4}\cdot\frac{\pi^2}{6}=\color{red}{-\frac{\pi^2}{8}}. $$


Here is a slight variation on a theme.

Making use of the result $\tanh^2 x = 1 - \mbox{sech}^2 x$, we can write the integral as $$I = \frac{1}{2} \int_0^\infty \ln (1 - \text{sech}^2 x) \, dx.$$ Setting $\text{sech}^2 x \mapsto x$ gives $$I = \frac{1}{4} \int_0^1 \frac{\ln (1 - x)}{x \sqrt{1 - x}} \, dx.$$ There are many ways to evaluate this integral. One way is by enforcing a substitution of $x \mapsto 1 - x^2$. Doing so we arrive at $$I = \int_0^1 \frac{\ln x}{1 - x^2} \, dx,$$ which is exactly the same point @Jack D'Aurizio arrived at in his solution.

Departing from Jack, we now employ a self-similar substitution of $u = \dfrac{1 - x}{1 + x}$.

Thus $$I = \frac{1}{2} \int_0^1 \frac{1}{u} \ln \left (\frac{1 - u}{1 + u} \right ) \, du = \frac{1}{2} \int_0^1 \frac{\ln (1 - u)}{u} \, du - \frac{1}{2} \int_0^1 \frac{\ln (1 + u)}{u} \, du.$$ In the second of these integrals let $u \mapsto -u$ \begin{align*} I &= \frac{1}{2} \int_0^1 \frac{\ln (1 - u)}{u} \, du - \frac{1}{2} \int_0^{-1} \frac{\ln (1 - u)}{u} \, du\\ &= -\frac{1}{2} \text{Li}_2 (1) + \frac{1}{2} \text{Li}_2 (-1)\\ &= -\frac{1}{2} \cdot \frac{\pi^2}{6} + \frac{1}{2} \cdot -\frac{\pi^2}{12}\\ &= -\frac{\pi^2}{8}, \end{align*}
where use of the dilogarithm function has been made.