Evaluate the following integral: $$I=\int_0^{\pi} \ln(a^2-2a\cos x+1) \,dx$$
My attempt: Letting $t=\pi-x$
$$I=\int_0^{\pi} \ln(a^2+2a\cos t+1) \,dt$$ Adding both equations, $$2I=\int_0^{\pi} \ln(a^2+2a\cos x+1)((a^2-2a\cos x+1)) \,dx$$ $$\implies 2I=\int_0^{\pi}\ln(a^4-2a^2\cos 2x+1)dx$$
I don't think applying integration by parts will yield an answer and no substitution seems to be evident here. The final answer given at the end of the worksheet is $2\pi\ln a$. How do I go about evaluating this integral? Is there a clever method to find the primitive of this function?