That seems like a reasonable approach. Differentiate with respect to a and exchange the derivative and integral. You should get a rational function of cos x which you can integrate. Then you will have to integrate with respect to a and evaluate the constant by looking at a=0.
So what do you get for the derivative of log(1+a cos x) with respect to a?