Q:

why can't we define a branch of $\log f(z)$ in the whole complex plane?

My question is really simple. The only problem to define a branch of $\log f(z)$ in the whole complex plane is because we can have $f(z)=0$ for some $z\in \mathbb C$? In fact I think I don't understand well what's the problem to define $\log f(z)$ in the whole complex plane. Could someone clarifies this for me? 

A:

The problem you address is already manifest for the simple "function" $z\mapsto \log z$. We want $e^{\log z}=z$ in a neighborhood of $z=1$, say. We know that the equation $e^w=1$ has the infinitely many solutions $2k\pi i$, and we then for sake of simplicity choose $w=0$ as our "target" solution. After some computation with real and imaginary parts, etc., we can say that
$${\rm Log}\,z:=\log|z|+i {\rm Arg}\,z\ ,$$
where ${\rm Arg}\,z\in\>]{-\pi},\pi[\>$ denotes the polar angle of $z$, indeed satisfies $e^{{\rm Log}\,z}=z$ in the plane without the negative real axis (and, of course, ${\rm Log}\,1=0$). Furthermore this principal value of the logarithm is an analytic function in this cut out plane, and has derivative $z\mapsto{1\over z}$ there. But it is impossible to extend this function  to a continuous function defined in the full punctured plane: If you approch the slit at $-1$ from above ${\rm Arg}\,z$ converges to $\pi$, and if you approach the point $-1$ from below ${\rm Arg}\,z$ converges to $-\pi$.
Now assume that you have an analytic function $f$ with an $m$-fold $(m\geq0)$ zero at $p$. Then $f(z)=(z-p)^m g(z)$, whereby $g$ is analytic in a neighborhood $U$ of $p$, and $g(z)\ne0$ in $U$. A hypothetical function
$$h(z):=\log\bigl(f(z)\bigr)$$ would have to satisfy
$$h'(z)={1\over f(z)}f'(z)={m\over z-p}+{g'(z)\over g(z)}\ .$$
The term ${g'(z)\over g(z)}$ has a primitive in $U$, but the term ${m\over z-p}$ does not have a primitive, even in $\dot U$, for the reasons explained above. This shows that we cannot define $h$ as a bona fide function in a punctured neighborhood of any zero of $f$.

A:

Of course, you can't define $\log 0$ since there's no complex number $z$ with $e^z=0$. But as long as $f(z)\neq 0$, there's no problem defining $\log f(z)$.
But it may not be the case that $\log f$ is continuous.

A:

If $f$ is holomorphic on an open connected set $\mathcal{D}$, let's agree that $f$ has a logarithm on $\mathcal{D}$ if $f(z)=e^{g(z)}$ for some $g$ that is holomorphic on $\mathcal{D}$. Then it is necessary that $f(z) \ne 0$ in $\mathcal{D}$. But more is required because $\frac{f'(z)}{f(z)}=g'(z)$ must hold, which means $f'/f$ must have an antiderivative in $\mathcal{D}$. And, conversely, if $f'/f$ has an antiderivative in $\mathcal{D}$, then it is true that $f$ has a logarithm in the above sense. That is, if $f'/f=g'$ for some holomorphic function $g$ on $\mathcal{D}$, then $fe^{-g}$ satisfies
$$
          (fe^{-g})'=f'e^{-g}-fg'e^{-g}=\frac{f'}{f}-g'=0,
$$
which forces $fe^{-g}=C$ where $C$ is a constant (this is because $\mathcal{D}$ is connected.) The constant $C$ cannot be $0$ in that case because $f$ is assumed non-vanishing. By incorporating $C$ into the exponent, $f=e^{g+K}$ and, hence, $g+K$ is a logarithm of $f$. So, if $f$ is non-vanishing in $\mathcal{D}$, then $f$ has a logarithm iff $\int_{\gamma}\frac{f'}{f}dz=0$ for every closed path $\gamma$ in $\mathcal{D}$. For example, $z^2$ cannot have a logarithm in the annulus $1 < |z| < 2$; even though $z^2$ is non-vanishing in the annulus, $\int_{|z|=1.5}\frac{2z}{z^2}dz \ne 0$.

