How to evaluate $\int_0^1\frac{\log^2(1+x)}x\mathrm dx$? The definite integral
$$\int_0^1\frac{\log^2(1+x)}x\mathrm dx=\frac{\zeta(3)}4$$
arose in my answer to this question. I couldn't find it treated anywhere online. I eventually found two ways to evaluate the integral, and I'm posting them as answers, but they both seem like a complicated detour for a simple result, so I'm posting this question not only to record my answers but also to ask whether there's a more elegant derivation of the result.
Note that either using the method described in this blog post or substituting the power series for $\log(1+x)$ and using
$$\frac1k\frac1{s-k}=\frac1s\left(\frac1k+\frac1{s-k}\right)\;$$
yields
$$
\int_0^1\frac{\log^2(1+x)}x\mathrm dx=2\sum_{n=1}^\infty\frac{(-1)^{n+1}H_n}{(n+1)^2}\;.
$$
However, since the corresponding identity without the alternating sign is used to obtain the sum by evaluating the integral and not vice versa, I'm not sure that this constitutes progress.

We can combine the present integral with the similar integral
$$
\int_0^1\frac{\log^2(1-x)}x\mathrm dx=2\zeta(3)
$$
(see my other answer) into
$$
\begin{align}
\int_0^1\frac{\log^2(1+x)}x\mathrm dx-\int_0^1\frac{\log^2(1-x)}x\mathrm dx
&=
\int_0^1\frac{\log^2(1+x)}x\mathrm dx+\int_{-1}^0\frac{\log^2(1+x)}x\mathrm dx
\\
&=
\int_{-1}^1\frac{\log^2(1+x)}x\mathrm dx\;.
\end{align}
$$
Then we can complete the contour of integration by a semicircle in the upper half complex plane:
$$
\begin{align}
\int_{-1}^1\frac{\log^2(1+x)}x\mathrm dx
&=
\oint\frac{\log^2(1+z)}z\mathrm dz-\int\frac{\log^2\left(1+\def\e{\mathrm e^{\mathrm i\phi}}\e\right)}{\e}\mathrm d\e
\\
&=
-\mathrm i\int_0^\pi\log^2\left(1+\e\right)\mathrm d\phi\;,
\end{align}
$$
where the integral over the closed contour vanishes since there are no poles inside the contour.
We know that the imaginary part of this expression vanishes, since it sums to zero with a real integral, so we only have to evaluate the real part:
$$
\begin{align}
-\mathrm i\int_0^\pi\log^2\left(1+\e\right)\mathrm d\phi
&=
\Re\left(-\mathrm i\int_0^\pi\log^2\left(1+\e\right)\mathrm d\phi\right)
\\
&=
\Re\left(-\mathrm i\int_0^\pi\left(\log\left|1+\e\right|+\mathrm i\arg\left(1+\e\right)\right)^2\mathrm d\phi\right)
\\
&=
2\int_0^\pi\log\left|1+\e\right|\arg\left(1+\e\right)\mathrm d\phi
\\
&=
2\int_0^\pi\frac12\log\left(2+2\cos\phi\right)\frac\phi2\mathrm d\phi
\\
&=
\frac12\int_0^\pi\log\left(\left(\mathrm e^{\mathrm i\phi/2}+\mathrm e^{-\mathrm i\phi/2}\right)^2\right)\phi\mathrm d\phi
\\
&=
\int_0^\pi\log\left(\mathrm e^{\mathrm i\phi/2}+\mathrm e^{-\mathrm i\phi/2}\right)\phi\,\mathrm d\phi
\\
&=
\Re\int_0^\pi\left(\frac{\mathrm i\phi}2+\log\left(1+\mathrm e^{-\mathrm i\phi}\right)\right)\phi\,\mathrm d\phi
\\
&=
\Re\int_0^\pi\sum_{n=1}^\infty\frac{(-1)^{n+1}\mathrm e^{-\mathrm in\phi}}n\phi\,\mathrm d\phi
\\
&=
\sum_{n=1}^\infty\frac{-1+(-1)^n}{n^3}
\\
&=
-\zeta(3)-\eta(3)
\\
&=
-\zeta(3)-\frac34\zeta(3)
\\
&=
-\frac74\zeta(3)\;.
\end{align}
$$
The desired integral is the sum of the two results:
$$
\begin{align}
\int_0^1\frac{\log^2(1+x)}x\mathrm dx
&=
\int_0^1\frac{\log^2(1-x)}x\mathrm dx-\mathrm i\int_0^\pi\log^2\left(1+\e\right)\mathrm d\phi
\\
&=
2\zeta(3)-\frac74\zeta(3)
\\
&=
\frac{\zeta(3)}4
\;.
\end{align}
$$
This raises the question whether there's a deeper reason for both of these seemingly quite different integrals to evaluate to a multiple of $\zeta(3)$.
