A question regarding mean value property of harmonic functions.

Show that the mean value formula, i.e $u(0) = \frac{1}{2\pi}\int_0^{2\pi} u(r \exp(i\theta))\,d\theta$, remains valid for $u = \log|z+1|, r = 1$, and use this fact to compute $\int_0^\pi \log(\sin(\theta))\,d\theta$.

It is clear that $u(z) = \log|z+1|$ is harmonic as long as $|z| < 1$. Also $u(z)$ is well defined for $|z|=1, z\ne -1$. This means that $u(0) = \frac{1}{2\pi}\int_0^{2\pi} u(r\exp(i\theta))\,d\theta \,\,\,\forall r \lt 1$. Because $r$ can be chosen arbitrarily close to 1, is this sufficient to conclude the validity of the mean value formula even for $r = 1$?

$u(\exp(i\theta))= \log(2|\cos\frac{\theta}{2}|)$. Assuming the validity for $r=1$, I get $u(0)=\frac{1}{2\pi}\int_0^{2\pi}(\log2 + \log|\cos(\frac{\theta}{2})|)\,d\theta$. But $u(0)=0$, and from the last integral I finally get $\int_0^{\pi}\log|\cos(\theta)|\,d\theta = -\pi \log(2)$. However, if I use $u(z) = \log|z-1|$, the desired result $\int_0^{\pi}\log\,\sin(\theta)\,d\theta = -\pi \log(2)$ is obtained.

It occurs to me that both the integrals should evaluate to same value of $-\pi \log(2)$ because $|\cos(\theta)|$ and $\sin(\theta)$ span the same area in $0\le\theta\le\pi$. However I verified from http://www.wolframalpha.com/widgets/view.jsp?id=8ab70731b1553f17c11a3bbc87e0b605 and it evaluates $\int_0^{\pi}\log|\cos(\theta)|\,d\theta = -\pi \log(2) + i\epsilon$ where $epsilon$ is very small. Is this correct and i am missing some important point?

The $i \epsilon$ term is the result of defining a branch cut of $\log{z}$ about the negative $x$-axis. The function $\cos{\theta}$ evaluates to -1 at the end of the integration interval, so the expression of the imaginary perturbation was necessary to stay on one side of the branch cut. The function $\sin{\theta}$ has no such difficulty and avoids that branch cut; thus, no $i \epsilon$ term.
thanks for the response. $cos(\theta)$ evaluates to -1 only at the end of the integration interval. Nevertheless the branch may be at $\pi/2$. Does $\epsilon$ have a definite value or its just arbitrarily close to 0. – vnd Dec 26 '12 at 21:38
or may be we have to avoid the positive imaginary axis here? in which case $\epsilon$ can be treated to be vanishingly small. the value given on the website is only representative – vnd Dec 26 '12 at 21:55
Yes, $\epsilon$ is vanishingly small. But its sign is an artifact of what branch cut was chosen. So, numerically, it is meaningless, but for understanding the framework from which the result was derived, it is important. – Ron Gordon Dec 26 '12 at 21:59