Write $$\log(\cos(x))=\log\left(\frac12 e^{ix}(1+e^{-2ix})\right)\\
=-\log 2 + ix +\sum_{k=1}^\infty\frac{(-1)^{k+1}}{k}e^{-2ikx}.$$
Then integrate term by term to obtain
$$\int_0^{\pi/4}\log(\cos(x))dx=-\frac{\pi}{4}\log 2 +i\frac{\pi^2}{32}+\frac{i}{2}\sum_{k=1}^\infty\frac{(-1)^{k+1}}{k^2}\left[e^{-ik\pi/2}-1\right].$$
The odd terms of the series with $e^{-ik\pi/2}$ give rise to the Catalan constant, and the even terms combine with the other infinite series to cancel the $i\pi^2/32$ term.
Performine the change of variables: $z = e^{ix}$, then , $x =\frac{1}{i}\log(z)$. The integral takes the form:
$ I = \Re \int_{|z|=1 \arg(z)=0}^{|z|=1 \arg(z)=\frac{\pi}{2}} \log \big(-(\log(z))^2 +(\log(\frac{z^2+1}{2z}))^2\big ) \frac{dz}{iz} $
The real part is added, since the logarithm of the cosine is singular at $x = \frac{\pi}{2}$ and can pick up an imaginary part. Expressing the difference of squares as a product we obtain:
$ = \Re\int_{|z|=1 \arg(z)=0}^{|z|=1\arg(z)=\frac{\pi}{2}}\big ( (\log(\log(\frac{z^2+1}{2})) + (\log(\log(\frac{z^{-2}+1}{2})) \frac{dz}{iz}$.
The second part of the integral can be brought to the form of the first part by the transformation $z\rightarrow z^{-1}$ , thus
$ I = \Re\int_{|z|=1 \arg(z)=0}^{|z|=1\arg(z)=\pi}\big ( (\log(\log(\frac{z^2+1}{2})) \frac{dz}{iz}$.
The integrand is invariant under the transformation $z\rightarrow -z$, thus:
$ I = \Re\frac{1}{2}\oint_{|z|=1 } \big ( (\log(\log(\frac{z^2+1}{2})) \frac{dz}{iz}$.
The numerator has no poles in the unit disc, thus using the residue theorem:
$I = \Re \frac{2\pi i}{2 i}\log(\log(-2)) = \pi \log(\log(2))$.
Best Answer
Your integral can be expressed in terms of certain special functions: $$\begin{align} \int_0^{\pi/2}\frac{x}{\sin x}\log^2\left(\frac{1+\cos x-\sin x}{1+\cos x+\sin x}\right)dx&=\frac{\,\pi^2}6K+4\,\beta(4)\\&=\frac{\,\pi^2}6K-\frac{\pi^4}{24}+\frac1{192}\psi^{(3)}\left(\frac14\right)\\&=\frac{\,\pi^2}6K-\frac{119\,\pi^4}{2880}-\frac1{32}H^{(4)}_{-3/4},\end{align}$$ where $K$ is Catalan's constant, $\beta(x)$ is the Dirichlet beta function, $\psi^{(n)}(z)$ is the polygamma function and $H^{(r)}_n$ is the generalized harmonic number.