Calculate singular integral Show that 

$$\int_{0}^{1}\log(\sin(\pi x)) dx=-\log(2).$$

I've tried using a toy contour consisting of a rectangle, but I don't know what to do with the singularities at $0$ and $1$. 
Every solution is welcomed, but I prefer to use complex analysis.
 A: That has been asked many times. I will propose four approaches.


*

*Riemann sums
The trigonometric identity
$$ \prod_{k=1}^{n-1}\sin\frac{\pi k}{n} = \frac{2n}{2^n} $$
leads to
$$ \frac{1}{n}\sum_{k=1}^{n-1}\log\sin\frac{\pi k}{n} = \frac{\log(2n)}{n}-\log(2) $$
then to $\int_{0}^{1}\log\sin(\pi x)\,dx = -\log(2)$ by considering the limit as $n\to +\infty$.


*Symmetry
The function $\sin(\pi x)$ is symmetric with respect to $x=\frac{1}{2}$, hence
$$\begin{eqnarray*}I=\int_{0}^{1}\log\sin(\pi x)\,dx&\stackrel{x\to 2z}{=}&2\int_{0}^{1/2}\left[\log(2)+\log\sin(\pi z)+\log\cos(\pi z)\right]\,dz\\&=&\log(2)+2I.\end{eqnarray*}$$


*An obscene overkill
By Raabe's theorem $\int_{a}^{a+1}\log\Gamma(x)\,dx = \log\sqrt{2\pi}+a\log a-a$ and by the reflection formula for the $\Gamma$ function $\frac{\pi}{\sin(\pi z)}=\Gamma(z)\Gamma(1-z)$, hence the question is trivial by switching to logarithms and integrating over $(0,1)$.


*Fourier series
$\log\sin(x)$ has a nice Fourier series whose termwise integration is straightforward.
A: 
Inasmuch as the OP states a preference of complex analysis, we proceed accordingly.


Let $I$ be given by  
$$\begin{align}
I&=\int_0^1 \log(\sin(\pi x))\,dx\\\\
&=\frac{1}{\pi}\int_0^{\pi }\log(\sin(x))\,dx\tag 1
\end{align}$$

We use Euler's Formula to write $(1)$ as 
$$\begin{align}
I&=\frac{1}{\pi}\int_0^{\pi }\log\left(\frac{e^{ix}-e^{-ix}}{2i}\right)\,dx\\\\
&=-\log(2)+\frac{1}{\pi}\lim_{\epsilon\to 0}\int_{\epsilon/2}^{\pi-\epsilon/2 }\log\left(1-e^{-i2x}\right)\,dx\\\\
&=-\log(2)+\frac{1}{2\pi }\int_{\epsilon}^{2\pi -\epsilon}\log(1-e^{i\theta})\,d\theta\tag2
\end{align}$$

Now, we enforce the substitution $z=e^{i\theta}$ so that $d\theta=\frac{1}{iz}\,dz$.   The integration on the real line in $(2)$ transforms to contour integration in the $z$ plane defined by $|z|=1$, from $\arg(z) =\epsilon$ to $\arg(z)=2\pi -\epsilon$.  
Then, $(2)$ can be written
$$\bbox[5px,border:2px solid #C0A000]{I=-\log(2)+\frac {1}{2\pi i}\int_{e^{i\epsilon}, |z|=1}^{e^{i(2\pi-\epsilon )}}\frac{\log(1-z)}{z}\,dz} \tag 3$$
In $(3)$ we tacitly cut the plane along the real axis from $z=1$ to $z=\infty$.  

Note that $\frac{\log(1-z)}{z}$ is analytic within and on a closed ("Pac-Man") contour $C$ defined by $z=e^{i\theta}$ for $\epsilon \le \theta \le 2\pi -\epsilon$, and $z=1+2\sin(\epsilon/2) e^{i\nu}$ for $\pi/2 + \epsilon/2 \le \nu \le 3\pi/2 -\epsilon/2$.
Then, from Cauchy's Integral Theorem, we have $\oint_C \frac{\log(1-z)}{z}\,dz=0$, which implies
$$\begin{align}
\int_{e^{i\epsilon}, |z|=1}^{e^{i(2\pi-\epsilon )}}\frac{\log(1-z)}{z}\,dz&=-\int_{3\pi/2-\epsilon/2}^{\pi/2+\epsilon/2} \frac{\log(-2\sin(\epsilon/2) e^{i\nu})}{1+2\sin(\epsilon/2) e^{i\nu}}i2\sin(\epsilon/2) e^{i\nu}d\nu\tag4
\end{align}$$
As $\epsilon \to 0$ the  term on the right-hand side of $(4)$ approaches $0$ since $\sin(\epsilon/2)\log (\sin(\epsilon/2)) \to 0$ as $\epsilon \to 0$.

Putting it all together, letting $\epsilon\to 0$ in $(3)$ and applying $(4)$ reveals that 
$$\bbox[5px,border:2px solid #C0A000]{I=-\log(2)}$$
