<s>[INST] Evaluate $\int_0^{\pi/2} \ln \left(a^2\cos^2\theta +b^2\sin^2\theta\right) \,d\theta$ where $a,b$ are finite natural numbers 
Evaluate $$\int_0^{\pi/2} \ln \left(a^2\cos^2\theta +b^2\sin^2\theta\right) \,d\theta$$ where $a,b$ are finite natural numbers 

I have spent about a day thinking over this problem.  I tried integration by parts, differentiating under integral sign (Feynman's trick, with respect to $a, b$), using some trigonometric and logarithmic properties like changing $\cos^2\theta$ to $\cos2\theta$ and hereafter some logarithmic properties, etc.,  but failed miserably. 
Also tried to use the property that $$\int_a^b f(x)\,dx=\int_a^b f(a+b-x)\,dx$$ in-between, but still to no avail. I also tried to find similar questions on MSE but did not get a related one. 
Can someone please help me to solve this integral?
Edit
My try (Feynman's trick) :
Let $$I(a)=\int_0^{\pi/2} \ln \left(a^2\cos^2\theta +b^2\sin^2\theta\right) d\theta$$
Hence $$I'(a) =\frac 1a \int_0^{\pi/2} \frac {2a^2\cos^2\theta d\theta}{a^2\cos^2\theta +b^2\sin^2\theta}$$ $$=\frac 1a\left[ \frac {\pi}{2}+\int_0^{\pi/2} \frac {a^2\cos^2\theta -b^2\sin^2\theta}{a^2\cos^2\theta +b^2\sin^2\theta}\right]$$
Wherein between I broke $2a^2\cos^2\theta=a^2\cos^2\theta +b^2\sin^2\theta+a^2\cos^2\theta -b^2\sin^2\theta$
But now how do I continue further
 [/INST] Let $I(a,b)=\int_0^{\pi/2} \log(a^2\cos^2(\theta)+b^2\sin^2(\theta))\,d\theta$.  Differentiating under the integral with respect to $a^2$ reveals
$$\begin{align}
\frac{\partial I(a,b)}{\partial (a^2)}&=\int_0^{\pi/2}\frac{1}{a^2+b^2\tan^2(\theta)}\,d\theta\\\\
&=\frac{\pi/2}{a(a+b)}\tag1
\end{align}$$
Integrating $(1)$ with respect to $a^2$, we obtain
$$I(a,b)=\pi \log(a+b)+C$$
For $a=b$, $I(a,a)=\pi \log(a)$ from which we find that $C=-\pi\log(2)$.
Putting it all together yields
$$I(a,b)=\pi \log\left(\frac{a+b}2\right)$$


NOTE:

We see from symmetry that  $I(a,b)=\pi \log\left(\frac{|a|+|b|}2\right)$   $\forall (a,b)\in \mathbb{R}^2\setminus (0,0)$.
</s>