TITLE: Apparent complex integration paradox
QUESTION [5 upvotes]: I encountered the following integral :
$$ 
\int_{\gamma} \frac{dz}{z-1-i},
$$
which has to be integrated along two straight-line contours :

$\gamma_{1} : 2i$ to $3$
$\gamma_{2} : 3$ to $0$ and then from $0$ to $2i$.

The integral will be $\log (z-1-i)$, of course. Considering principal values of complex logarithms for uniqueness we get the following results :

$\log(2-i) - \log(i-1)$
$\log(i-1) - \log(2-i)$.

All good (not really). Now, consider adding the two integrals above. This will form a closed loop with a simple pole at $1+i$ so the result should be $2\pi i$ by Cauchy Integral formula. However, adding the above two gives zero. How come?
I thought I was doing the integrals incorrectly so I checked with WolframAlpha as well but apparently I can't find any issues.
Would appreciate any help. Thanks!

REPLY [7 votes]: The domain of the principal value of the logarithm $\log$ is $\Bbb C\setminus(-\infty,0]$. Therefore, the domain of $\log(z-1-i)$ is $\Bbb C\setminus\{t+i\mid t\in(-\infty,1]\}$.  But when you go from $3$ to $0$ and then from $0$ to $2i$, you pass through $i$, which belongs to $\{t+i\mid t\in(-\infty,1]\}$. So, you have no reason to assert that$$\int_{\gamma_2}\frac{\mathrm dz}{z-1-i}=\log(i-1)-\log(2-i),$$since $\log(z-1-i)$ is not an antiderivative of $\frac1{z-1-i}$ along the image of $\gamma_2$.