Inapplicability of Gauss' mean value theorem in an integration What is the value of $$\int_0^{2\pi}\ln|i+2e^{ix}|dx$$
At first glance I thought of applying Gauss mean value theorem, but this is not applicable here as $\ln|z|$ is not analytic at $0$, which belongs in the region $|z-i|<2$. 
How one can approach this one? Any help is appreciated.
 A: There is a beautiful (and theoretically very important) generalization of Gauss' mean value theorem, it is called the Jensen's formula. Given that you know Gauss' mean value theorem you can look up the proof of Jensen in Chapter 5 of Stein-Shakarachi's Complex Analysis.
Jensen's Formula: Let $\Omega$ be an open set that contains the closure of a disc $D_R$ and suppose that $f$ is holomorphic in $Ω$, $f (0)\neq 0$, and $f$ vanishes
nowhere on the circle $C_R$ . If $z_1 , . . . , z_N$ denote the zeros of $f$ inside the
disc (counted with multiplicities), then $$\log|f(0)|=\sum_{i=1}^{N} \log\Bigg(\frac{|z_k|}{R}\Bigg)+\frac{1}{2\pi}\int_{0}^{2\pi}\log|f(Re^{i\theta})|d\theta$$
You have to use Jensen here, because unfortunately the function $f(z)=z+i$ has a root in $|z|<2$, and $\log|.|$ of it won't satisfy the hypothesis of Gauss' mean value theorem unless we make some clever manipulations.
Now apply the above for $f(z)=z+i$, then we have that 
$$\log|i|=\log|1/2|+\frac{1}{2\pi}\int_{0}^{2\pi}\log|2e^{i\theta}+i|d\theta$$ which immediately gives $$\int_{0}^{2\pi}\log|2e^{i\theta}+i|d\theta=2\pi\log(2).$$
A: Too long for a comment, but using $e^{i\theta}=\cos\theta+i\sin\theta$ we have
$$|i+2\cos(x)+2i\sin(x)|=\sqrt{4\cos^2 x+(1+2\sin x)^2}=\sqrt{4\cos^2x+1+4\sin^2x+4\sin x}$$
so that
$$I=\frac{1}{2}\int_0^{2\pi}\ln(5+4\sin x)dx=\frac{1}{2}\int_0^{2\pi}\ln(4)dx+\frac{1}{2}\int_0^{2\pi}\ln\left(\frac{5}{4}+\sin x\right)dx.$$
Hence
$$I=2\pi\log(2)+\frac{1}{2}\int_0^{2\pi}\ln\left(\frac{5}{4}+\sin x\right)dx=2\pi\log 2.$$
The only way I could show the integral to vanish was using the power series for $\log(1+z)$,
$$\int_0^{2\pi}\ln\left(\frac{5}{4}\left(1+\frac{4}{5}\sin x\right)\right)dx=2\pi\ln(5/4)+\int_0^{2\pi}\ln\left(1+\frac{4}{5}\sin x\right)dx=J.$$
Assuming we can switch integral and infinite sum, and  since $4/5|\sin x|<1$, then the integral becomes
$$-\sum_{k=1}^\infty\frac{(-1)^k}{k}\frac{4^k}{5^k}\int_0^{2\pi}\sin^k xdx=-\frac{1}{2}\sum_{k=1}^\infty\frac{1}{k}\frac{4^{2k}}{5^{2k}}\frac{\pi  \cdot\left(\frac{3}{2}\right)_{k-1}}{\Gamma (k+1)}=-2\pi\log(5/4),$$
hence $J=0$.
