Integral $\int_0^{\pi/4} \frac{\ln \tan x}{\cos 2x} dx=-\frac{\pi^2}{8}.$ $$I:=\int_0^{\pi/4} \frac{\ln \tan x}{\cos 2x} dx=-\frac{\pi^2}{8}.$$ 
I am trying to see nice solutions to this integral.  I tried the following
$$
I=\int_0^{\pi/4}\frac{\ln \sin x}{\cos 2x} dx-\int_0^{\pi/4} \frac{\ln \cos x }{\cos 2x}dx
$$
but am not sure how to work with this denominator of $\cos 2x$.  If this helps:
$$
\int_0^{\pi/4}\log \sin x \, dx=-\frac{1}{4}\big(2K+\pi \ln 2\big)
$$
where K is the Catalan constant (note I am using Borwein convention not mathematica of using a C to define this constant.)  It is given by
$$
K=\sum_{k=0}^\infty \frac{(-1)^k}{(2k+1)^2}=\beta(2) 
$$
where $\beta(2)$ is the  Dirichlet beta function.
However I cannot solve this integral either.  Thanks
 A: $\newcommand{\+}{^{\dagger}}
 \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\down}{\downarrow}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\isdiv}{\,\left.\right\vert\,}
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}
 \newcommand{\wt}[1]{\widetilde{#1}}$
$\ds{I \equiv \int_{0}^{\pi/4}{\ln\pars{\tan\pars{x}} \over \cos\pars{2x}}\,\dd x
     =-\,{\pi^{2} \over 8}:\ {\large ?}}$.

\begin{align}
I&=\half\int_{0}^{\pi/2}{\ln\pars{\tan\pars{x/2}} \over \cos\pars{x}}\,\dd x
=\half\int_{0}^{1}{\ln\pars{t} \over \pars{1 - t^{2}}/\pars{1 + t^{2}}}\,
{2\,\dd t \over 1 + t^{2}}
=\int_{0}^{1}{\ln\pars{t} \over 1 - t^{2}}\,\dd t
\\[3mm]&=\int_{0}^{1}{\ln\pars{t^{1/2}} \over 1 - t}\,\half\,t^{-1/2}\,\dd t
={1 \over 4}\int_{0}^{1}{t^{-1/2}\ln\pars{t} \over 1 - t}\,\dd t
=-\,{1 \over 4}\lim_{s \to -1/2}\partiald{}{s}
\int_{0}^{1}{1 - t^{s} \over 1 - t}\,\dd t
\end{align}

However,
$\ds{\int_{0}^{1}{1 - t^{s} \over 1 - t}\,\dd t = \Psi\pars{s + 1} + \gamma}$. See ${\bf 6.3.22}$ in this link.
$\ds{\Psi\pars{z}}$ and $\ds{\gamma}$ are the Digamma Function and the Euler-Mascheroni Constant, respectively.
Then,
$$
I = -\,{1 \over 4}\,\Psi'\pars{\half}
$$ 

With Euler Reflection Formula
  ${\bf 6.4.7}$, $\ds{\Psi'\pars{\half}
=\left.-\,\half\,\pi\cot'\pars{\pi z}\right\vert_{\,z\ =\ \half}
=\half\,\pi^{2}\csc^{2}\pars{\pi \over 2} = {\pi^{2} \over 2}}$

$$
\color{#00f}{\large%
I = \int_{0}^{\pi/4}{\ln\pars{\tan\pars{x}} \over \cos\pars{2x}}\,\dd x
= -\,{\pi^{2} \over 8}}
$$
A: Let $\tan x=e^{-t}$, then $$\cos 2x=\cos^2x-\sin^2x=\frac{1-e^{-2t}}{1+e^{-2t}}$$ and $$dx=-\frac{e^{-t}\ dt}{1+e^{-2t}}.$$ Therefore
$$\begin{align}
\int_0^{\pi/4} \frac{\ln \tan x}{\cos 2x} dx&=-\int_\infty^{0} \frac{\ln e^{-t}}{\dfrac{1-e^{-2t}}{1+e^{-2t}}}\cdot \frac{e^{-t}\ dt}{1+e^{-2t}}\\
&=-\int_0^{\infty}\frac{te^{-t}}{1-e^{-2t}} dt\tag1
\end{align}$$
Equation $(1)$ can be solved by using IBP. Let $u=t\;\rightarrow du=dt$ and
$$\begin{align}
dv&=\frac{e^{-t}}{1-e^{-2t}} dt\\
v&=\int\frac{e^{-t}}{1-e^{-2t}} dt\\
&=-\int\frac{d\left(e^{-t}\right)}{1-e^{-2t}}\quad\Rightarrow\quad y=e^{-t}\\
&=-\int\frac{dy}{1-y^2}\\
&=-\frac12\left(\int\frac{dy}{1-y}+\int\frac{dy}{1+y}\right)\\
&=\frac12\ln\left(1-y\right)-\frac12\ln\left(1+y\right)\\
&=\frac12\ln\left(1-e^{-t}\right)-\frac12\ln\left(1+e^{-t}\right).
\end{align}$$
Hence
$$\begin{align}
-\int_0^{\infty}\frac{te^{-t}}{1-e^{-2t}} dt&=\left[\frac t2\ln\left(1-e^{-t}\right)+\frac t2\ln\left(1+e^{-t}\right)\right]_0^{\infty}\\&\frac12\int_0^{\infty}\ln\left(1-e^{-t}\right)\ dt-\frac12\int_0^{\infty}\ln\left(1+e^{-t}\right)\ dt\\
&=\frac12\int_0^{\infty}\ln\left(1-e^{-t}\right)\ dt-\frac12\int_0^{\infty}\ln\left(1+e^{-t}\right)\ dt\\
&=\frac12\int_0^1\ln\left(1-y\right)\ dy-\frac12\int_0^{1}\ln\left(1+y\right)\ dy.
\end{align}$$
Since $|y|<1$, we can use Maclaurin series for natural logarithm.
$$\begin{align}
-\int_0^{\infty}\frac{te^{-t}}{1-e^{-2t}} dt
&=\frac12\int_0^1\ln\left(1-y\right)\ dy-\frac12\int_0^{1}\ln\left(1+y\right)\ dy\\
&=-\frac12\int_0^1\sum_{n=1}^\infty\frac{y^n}{n}\ dy-\frac12\int_0^{1}\sum_{n=1}^\infty(-1)^{n+1}\frac{y^n}{n}\ dy\\
&=-\frac12\sum_{n=1}^\infty\frac{1}{n^2}-\frac12\sum_{n=1}^\infty(-1)^{n+1}\frac{1}{n^2}\\
&=-\frac12\zeta(2)-\frac12\eta(2)\\
&=-\frac12\zeta(2)-\frac14\zeta(2)\\
&=\Large\color{blue}{-\frac{\pi^2}{8}},
\end{align}$$
where $\zeta(s)$ is Riemann zeta function, $\eta(s)$ is Dirichlet eta function,  and $\zeta(2)=\dfrac{\pi^2}{6}$.
A: Introduce variables $t$ and $y$ such that $t = \tan x = e^{-y}$, we have
$$\begin{align}
\int_0^{\pi/4}\frac{\log\tan x}{\cos 2x} dx
&= \int_0^1\frac{\log t}{\frac{1-t^2}{1+t^2}}\frac{dt}{1+t^2}\\
&= -\int_0^\infty \frac{y}{1 - e^{-2y}} e^{-y} dy
= -\int_0^\infty \sum_{k=0}^\infty y e^{-(2k+1)y} dy\\
&= -\sum_{k=0}^\infty\frac{1}{(2k+1)^2}
= -\left[\sum_{k=1}^\infty\frac{1}{k^2} - \sum_{k=1}^\infty\frac{1}{(2k)^2}\right]\\
&= -\left(1-\frac14 \right)\zeta(2) = -\frac{\pi^2}{8}
\end{align}
$$
A: achille hui's solution is very nice.
My investigation of this integral yielded the following result of independent interest:
$$
\frac {1} {3} \int _0 ^{\pi /2} \frac {\ln(1-\cos x)} {\cos x}  dx = \int _0 ^{\pi /2} \frac {\ln \sin x} {\cos x}  dx = -\frac {\pi ^2} {8}
$$
I wonder if the first equality can be proven using symmetry properties only?
(May I ask where you get all these nice integrals, by the way?)
A: Using
$$
\sin^2(x)=\frac{1-\cos(2x)}{2}\qquad\text{and}\qquad
\cos^2(x)=\frac{1+\cos(2x)}{2}\tag{1}
$$
and
$$
\frac12\log\left(\frac{1+x}{1-x}\right)=x+\frac{x^3}{3}+\frac{x^5}{5}+\dots\tag{2}
$$
we get
$$
\begin{align}
\log(\tan(x))
&=\frac12\log\left(\sin^2(x)\right)-\frac12\log\left(\cos^2(x)\right)\\
&=\frac12\log\left(\frac{1-\cos(2x)}{2}\right)-\frac12\log\left(\frac{1+\cos(2x)}{2}\right)\\
&=-\frac12\log\left(\frac{1+\cos(2x)}{1-\cos(2x)}\right)\\
&=-\cos(2x)-\frac{\cos^3(2x)}{3}-\frac{\cos^5(2x)}{5}-\dots\tag{3}
\end{align}
$$
Using
$$
\begin{align}
\int_0^{\pi/4}\cos^{2n}(2x)\,\mathrm{d}x
&=\frac12\int_0^{\pi/2}\cos^{2n}(x)\,\mathrm{d}x\\
&=\frac\pi4\binom{2n}{n}4^{-n}\tag{4}
\end{align}
$$
we get
$$
\begin{align}
\int_0^{\pi/4}\frac{\log(\tan(x))}{\cos(2x)}\mathrm{d}x
&=-\frac\pi4\sum_{n=0}^\infty\binom{2n}{n}\frac{4^{-n}}{2n+1}\\
&=-\frac\pi4\sum_{n=0}^\infty\binom{2n}{n}\frac{4^{-n}\color{#C00000}{1}^{2n+1}}{2n+1}\\
&=-\frac\pi4\arcsin(\color{#C00000}{1})\\
&=-\frac{\pi^2}8\tag{5}
\end{align}
$$
A: $$
\begin{aligned}
\int_0^{\frac{\pi}{4}} \frac{\ln (\tan x)}{\cos 2 x} d x=&\int_0^{\frac{\pi}{4}} \frac{\ln \left(\tan \left(\frac{\pi}{4}-x\right)\right)}{\cos 2\left(\frac{\pi}{4}-x\right)} d x \\
=& \int_0^{\frac{\pi}{4}} \frac{\ln \left(\frac{\cos x-\sin x}{\cos x+\sin x}\right)}{\sin 2 x} d x\\=&\frac{1}{2} \int_0^{\frac{\pi}{4}} \frac{\ln \left(\frac{1-\sin 2 x}{1+\sin 2 x}\right)}{\sin 2 x} d x\\=&\frac{1}{4}\left[\int_0^{\frac{\pi}{2}} \frac{\ln (1-\sin x)}{\sin x} d x-\int_0^\frac\pi2 \frac{\ln (1+\sin x)}{\sin x} d x\right]
\end{aligned}
$$
From my post,
$$
\begin{aligned}
\int_0^{\frac{\pi}{2}} \frac{\ln (1+a \sin x)}{\sin x} d x &=\int_0^{\frac{\pi}{2}} \frac{\ln (1+a \cos x)}{\cos x} d x \\
&=\frac{\pi^2}{8}-\frac{\left(\cos ^{-1} a\right)^2}{2}
\end{aligned}
$$
Now we can conclude that
$$\int_0^{\frac{\pi}{4}} \frac{\ln (\tan x)}{\cos 2 x} d x =\frac{1}{4}\left(-\frac{3 \pi^2}{8^2}-\frac{\pi^2}{8}\right)=-\frac{\pi^2}{8} $$
A: $$
\begin{aligned}
I &\stackrel{t=\tan x}{=}\int_0^1 \frac{\ln t}{\frac{1-t^2}{1+t^2}} \cdot \frac{d t}{1+t^2} =\int_0^1 \frac{\ln t}{1-t^2} d t
\end{aligned}
$$
Expanding the denominator to a power series yields
$$
I=\sum_{k=0}^{\infty} \int_0^1 t^{2 k} \ln t d t
$$
Integration by parts gives $$
\begin{aligned}
I &=\sum_{k=0}^{\infty} \int_0^1 \ln t d\left(\frac{t^{2 k+1}}{2 k+1}\right) =\sum_{k=0}^{\infty}\left(\left[\frac{t^{2 k+1} \ln t}{2 k+1}\right]_0^1-\int_0^1 \frac{t^{2 k}}{2 k+1} d t\right) \\
&=-\sum_{k=0}^{\infty} \frac{1}{(2 k+1)^2}=-\left[\sum_{k=1}^{\infty} \frac{1}{k^2}-\sum_{k=1}^{\infty} \frac{1}{(2 k)^2}\right]=-\frac{3}{4} \sum_{k=1}^{\infty} \frac{1}{k^2} =-\frac{\pi^2}{8}\end{aligned}
$$
