I'm trying to compute
$$\int_{0}^{\pi/2} (\frac{\pi}{2} - x)\tan(x)\ dx.$$
This is an improper integral and according to Mathematica, its value is $\frac{\pi \log(2)}{2}$. I can't expand the product because $\int_{0}^{\pi/2} \tan(x)$ and $\int_{0}^{\pi/2} x\tan(x)$ both diverge. I also don't see any obvious substitutions. If possible, I'd like to see a solution using elementary methods (i.e. no contour integration).
In case this is relevant, I came across this integral when trying to find an alternate solution for this question. I started with
$$ \int_1^{\infty}\frac{\ln x}{x\sqrt{x^2-1}}\ dx. $$
By integration by parts, this is equal to
$$ -\log(x) \arctan(\frac{1}{\sqrt{x^2-1}})\Big|_1^\infty + \int_1^\infty \frac{\arctan(\frac{1}{\sqrt{x^2-1}})}{x}\ dx $$
The left term is $0$. For the right term, I substituted $x = \sec(u)$ and got the integral $$\int_0^{\pi/2} \arctan(\frac{1}{\tan(u)}) \tan(u) \ du.$$ Then, since $\tan(u)\geq 0$ for $u \in [0,\pi/2]$, I used the identity $\arctan(y) + \arctan(1/y) = \pi/2$ for all $y > 0$ to get the integral I'm asking about.