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
 A: 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)$.
A: If we assume $a,b>0$ and set 
$$ I(a,b)=\int_{0}^{\pi/2}\log(a^2\cos^2\theta+b^2\sin^2\theta)\,d\theta $$
we have $I(a,b)=I(b,a)$ from the substitution $\theta\mapsto\frac{\pi}{2}-\theta$. On the other hand $I(a,a)=\pi\log(a)$ is trivial, so $I(a,b)=\pi\log\left(\frac{a+b}{2}\right)$ is a very reasonable conjecture. Indeed, it can be proved by computing 
$$ \frac{\partial I}{\partial a} = \int_{0}^{\pi/2}\frac{2a\cos^2\theta}{a^2\cos^2\theta+b^2\sin^2\theta}\,d\theta $$
as suggested in the comments, i.e. via $\theta\mapsto\arctan u$ and partial fraction decomposition.
An alternative approach is to notice that
$$\begin{eqnarray*} I(a,b) &=& 2\,\text{Re}\int_{0}^{\pi/2}\log\left(a\cos\theta+ib\sin\theta\right)\\&=&\pi\log\left(\frac{a+b}{2}\right)+\text{Re}\int_{0}^{\pi}\log\left(e^{i\theta}+\frac{a-b}{a+b}\right)\,d\theta\end{eqnarray*}$$
where the last integral is a purely imaginary number by the residue theorem.
