We make the substitution $x \mapsto \cos^2x$ to get
$$
I := \int_{0}^{\frac{\pi}{2}}\frac{\ln\left(\sec^{2}x\right)\sec^{2}x}{\left(\sec^{2}x+1\right)\tan x}dx=-\int_{0}^{\frac{\pi}{2}}\frac{\ln\left(\cos^{2}x\right)\cot x}{1+\cos^{2}x}dx=\frac{1}{2}\int_{0}^{1}\frac{\ln x}{x^{2}-1}dx.
$$
Let $f(z) = \displaystyle\frac{\log z}{z^2-1}$ where $\operatorname{arg}(z) \in (-\pi,\pi]$ and the branch cut is on the negative real axis. The series expansion of $f(z)$ centered at $z=1$ is $\displaystyle \frac{1}{2}-\frac{z-1}{2}+\frac{5}{12}\left(z-1\right)^{2}+O\left(\left(z-1\right)^{3}\right)$, which tells us $z=1$ is a removable singularity.
Next, we traverse along the following contour in the positive direction.

Cauchy's Residue Theorem allows us to write
$$
0 = \left(\int_{r}^{1}+\int_{\Gamma}^{ }+\int_{i}^{ir}+\int_{\gamma}^{ }\right)f(z)dz.
$$
Equating the real part on both sides gives us
$$
0 = \int_{r}^{1}f(z)dz+\Re\int_{\Gamma}^{ }f(z)dz+\Re\int_{i}^{ir}f(z)dz+\Re\int_{\gamma}^{ }f(z)dz.
$$
We evaluate each contribution and take $r \to 0^+$ below.
$$
\begin{align}
I_2 &:= \Re\int_{\Gamma}^{ }f(z)dz \\
&= \Re\int_{0}^{\frac{\pi}{2}}\frac{\log\left(e^{i\theta}\right)}{\left(e^{i\theta}\right)^{2}-1}d\left(e^{i\theta}\right) \\
&= \Re\int_{0}^{\frac{\pi}{2}}\frac{ie^{i\theta}}{e^{2i\theta}-1}\log\left(e^{i\theta}\right)d\theta \\
&= \Re\int_{0}^{\frac{\pi}{2}}\frac{\csc\theta}{2}\left(\ln\left|e^{i\theta}\right|+i\operatorname{arg}\left(e^{i\theta}\right)\right)d\theta \\
&= \Re\frac{i}{2}\int_{0}^{\frac{\pi}{2}}\theta\csc\theta d\theta \\
&= 0 \\
\end{align}
$$
$$
\begin{align}
I_{3} &:= \Re\int_{i}^{ir}\frac{\log z}{z^{2}-1}dz \\
&= \Re\int_{1}^{r}\frac{\log\left(iy\right)}{\left(iy\right)^{2}-1}d\left(iy\right) \\
&= \Re i\int_{r}^{1}\frac{\log\left(iy\right)}{y^{2}+1}dy \\
&= \Re i\int_{r}^{1}\frac{\ln\left|iy\right|}{y^{2}+1}dy-\Re\int_{r}^{1}\frac{\operatorname{arg}\left(iy\right)}{y^{2}+1}dy \\
&= -\frac{\pi}{2}\int_{r}^{1}\frac{1}{y^{2}+1}dy \\
&\to -\frac{\pi}{2}\int_{0}^{1}\frac{1}{y^{2}+1}dy \\
&= -\frac{\pi^{2}}{8} \\
\end{align}
$$
$$
\begin{align}
I_4 &:= \int_{\gamma}f(z)dz \\
&= \int_{\frac{\pi}{2}}^{0}\frac{\log\left(re^{i\phi}\right)}{\left(re^{i\phi}\right)^{2}-1}d\left(re^{i\phi}\right) \\
&= ir\int_{0}^{\frac{\pi}{2}}\frac{e^{i\phi}\log\left(re^{i\phi}\right)}{1-r^{2}e^{2i\phi}}d\phi \\
&= ir\int_{0}^{\frac{\pi}{2}}\frac{e^{i\phi}\left(\ln\left|re^{i\phi}\right|+i\operatorname{arg}\left(re^{i\phi}\right)\right)}{1-r^{2}e^{2i\phi}}d\phi \\
&= ir\ln r\int_{0}^{\frac{\pi}{2}}\frac{e^{i\phi}}{1-r^{2}e^{2i\phi}}d\phi-r\int_{0}^{\frac{\pi}{2}}\frac{\phi e^{i\phi}}{1-r^{2}e^{2i\phi}}d\phi \\
&\to i\left(0\right)\int_{0}^{\frac{\pi}{2}}\frac{e^{i\phi}}{1-0^{2}e^{2i\phi}}d\phi-0\int_{0}^{\frac{\pi}{2}}\frac{\phi e^{i\phi}}{1-0^{2}e^{2i\phi}}d\phi \\
&= 0 \\
\end{align}
$$
Hence,
$$
\begin{align}
0 &= \lim_{r \to 0^+}I_1 + 0 -\frac{\pi^2}{8} + 0 \\
\implies I &= \frac{\pi^{2}}{16}\\
\end{align}
$$
and we're finished!