How to evaluate the definite integral $\int _{0}^{\frac{\pi }{2}}\frac{\ln(\tan x)}{1-\tan x+\tan^{2} x}\mathrm{d} x$? I am struggling with this integral:
$\displaystyle \int _{0}^{\frac{\pi }{2}}\frac{\ln(\tan x)}{1-\tan x+\tan^{2} x}\mathrm{d} x$
What I tried so far:
$\displaystyle \int _{0}^{\frac{\pi }{2}}\frac{\ln(\tan x)}{1-\tan x+\tan^{2} x}\mathrm{d} x$
$\displaystyle =\int _{0}^{\frac{\pi }{2}}\frac{\cos^{2} x\ln(\tan x)}{1-\sin x\cos x}\mathrm{d} x$
$\displaystyle =\int _{0}^{\frac{\pi }{2}}\frac{-\sin^{2} x\ln(\tan x)}{1-\sin x\cos x}\mathrm{d} x$
$\displaystyle =\frac{1}{2}\int _{0}^{\frac{\pi }{2}}\frac{\cos 2x\ln(\tan x)}{1-\sin x\cos x}\mathrm{d} x$
The answer should come out to be $\dfrac{-7\pi^2}{72}$.
Any help will be appreciated.
 A: Since
$$
\displaystyle \int _{0}^{\frac{\pi }{2}}\frac{\ln(\tan x)}{1-\tan x+\tan^{2} x}\mathrm{d} x=\int_0^{\infty} \frac{\ln t}{(1-t+t^2)(1+t^2)}dt,
$$
consider
$$
\begin{aligned}
\mathscr{I}(s)&=\int_0^{\infty} \frac{t^s}{(1-t+t^2)(1+t^2)}dt
\\&=\int_0^{\infty} \frac{t^{s-1}}{1-t+t^2}dt-\int_0^{\infty} \frac{t^{s-1}}{1+t^2}dt
\\&=\int_0^{\infty} \frac{t^{s-1}}{1+t^3}dt+\int_0^{\infty} \frac{t^{s}}{1+t^3}dt-\int_0^{\infty} \frac{t^{s-1}}{1+t^2}dt.
\end{aligned}
$$
With Beta function, we have
$$
\int_{0}^{\infty}\frac{t^{s-1}}{1+t^{a}}dt=\frac{\pi \csc(\frac{\pi s}{a})}{a}
$$
thus
$$
\mathscr{I}(s)=\frac{\pi \csc(\frac{\pi s}{3})}{3}+\frac{\pi \csc(\frac{1}{3} \pi (s+1))}{3}-\frac{\pi \csc(\frac{\pi s}{2})}{2}.
$$
In conclusion,
$$
\begin{aligned}
\int_0^{\frac{\pi}{2}}\frac{\ln \tan x}{1-\tan x+\tan^2 x}dx&=\lim_{s\to 0}\frac{\partial }{\partial s}\mathscr{I}(s)
\\&=\lim_{s\to 0}\left(-\frac{\pi^{2} \csc(\frac{\pi s}{3}) \cot(\frac{\pi s}{3})}{9}-\frac{\pi^{2} \csc(\frac{1}{3} \pi s+\frac{1}{3} \pi) \cot(\frac{1}{3} \pi s+\frac{1}{3} \pi)}{9}+\frac{\pi^{2} \csc(\frac{\pi s}{2}) \cot(\frac{\pi s}{2})}{4}\right)
\\&=-\frac{7 \pi^{2}}{72}
\end{aligned}
$$
A: Substitute $t=\tan x$\begin{align}
&\int _{0}^{\frac{\pi }{2}}\frac{\ln(\tan x)}{1-\tan x+\tan^{2} x}\mathrm{d} x \\
=&\int_0^1\frac{\ln t}{(1 - t + t^{2})(1 + t^{2})}dt
 + \int_1^\infty \frac{\ln t}{(1 - t + t^{2})(1 + t^{2})}\overset{t\to 1/t}{dt}\\
=& \int_0^1\frac{(1-t^2)\ln t}{(1 - t + t^{2})(1 + t^{2})}dt
= \int_0^1\frac{2t\ln t}{1 + t^{2}}\>\overset{ibp}{dt}
-\int_0^1\frac{(2t-1)\ln t}{1 - t + t^{2}}\>\overset{ibp}{dt}\\
=& \>-\int_0^1 \frac{\ln (1+t^2)}{t}\>\overset{t^2\to t}{dt} +\int_0^1 \frac{\ln (1+t^3)}t \>\overset{t^3\to t}{dt}-\int_0^1 \frac{\ln (1+t)}tdt\\
=& \>-\frac76 \int_0^1 \frac{\ln (1+t)}tdt= -\frac76 \cdot\frac{\pi^2}{12}=-\frac{7\pi^2}{72}
\end{align}
where $\int_0^1 \frac{\ln (1+t)}tdt=\frac{\pi^2}{12}$
