Different answers using different methods I stumbled upon this integral $$\int_0^{2\pi} \frac{4ie^{i\theta}}{4e^{i\theta}} d\theta$$.
Now if if do it using the formula$$\int\frac{f'(x)}{f(x)} dx=ln|f(x)|+C$$ then i have $$=ln|4e^{2\pi i}|-ln|4e^{(0) i}|$$ $$=ln|4|-ln|4|$$ $$=0$$
But if i cancel out  $4e^{i\theta}$ then i am left with $\theta$. And the integration results in $$=[\theta]_0^{2\pi}$$ $$=2\pi i$$. I know that there is something wrong . Please help...
 A: You do actually need the complex logarithm for your first approach. Taking the modulus of $f(x)$ in $\ln|f(x)|$ produces the mistake - for complex numbers $z$, we have $\ln(z)' = \frac 1z$, this is what you want to use - no modulus there! However, one has to be careful: The $\ln$ here is the complex logarithm, which is quite tricky on its own.
In order to understand the issues with the complex logarithm correctly, let's take a closer look: Consider the complex number $z = e^{i\theta}$. You might say that $\ln(z) = i\theta$. But now we also have $z = e^{i\theta +2i\pi}$. Now $\ln(z) = i\theta +2i\pi$! You get countably many possibilities for the logarithm. That's why you usually specify which 'option' you pick for the logarithm, that's called a 'branch'. Once you pick a branch, you have to be careful since the branch will have a discontinuity along a line starting from the origin - this is where you 'cut out' you particular branch of the logarithm. See Wikipedia for a detailed discussion of this property.
In order to remedy the first approach in your question, let us specify that $\ln$ is the branch mapping such that for $z\in\mathbb C\setminus\{0\}$ we have $\ln z = \ln|z| + i\arg(z)$, and $\arg(z)\in[0,2\pi)$ (which is a specification we make), and the logarithm of the modulus is just the classical, real logarithm. (Something like that should always be specified before working with a complex logarithm, in order to avoid confusion!)
Then 
$$\int_0^{2\pi}\frac{ie^{ix}}{e^{ix}} d x = \int_0^{2\pi} (\ln e^{ix})' d x = \int_0^{2\pi} (ix)' d x  = i\int_0^{2\pi} 1 d x =2i\pi.$$
In the first step we have used that on $\mathbb C\setminus \mathbb R_0^+$ we have $\ln(z)' = \frac 1z$. Note that in the second step we have used our specification of the logarithm-branch. You could also use another branch, but you have to be careful to choose it in a way that the integration path does not cross the branch cut (i.e. the discontinuity).
A: Appearantly you are integrating the following function 
$$\int_{\gamma}\frac{1}{z}dz$$
where we have $\gamma$ is a circle with radius equals to 4 and center at the origin . Now this function has no anti derivative in a nbhd of zero because of the branch point.
Another mistake is to assume that the integral equals to zero because the function is analytic on a closed contour which is not the case here. We have a pole at zero. By the residue theorem we have 
$$\int_{\gamma}\frac{1}{z}dz = 2\pi i \, \mathrm{Res}(f,0) = 2\pi i $$
Now using parametrization $z = 4e^{i\theta}$
$$\int_{0}^{2\pi}\frac{4ie^{i\theta}}{4e^{i\theta}}dz = 2\pi i $$
