Why does the integral $\int\frac{1}{x+i}dx$ not require the absolute value in the logarithm? Going through some old calculus exams, I find a solution to an integral via partial fraction decomposition. The solution manual does not perform full decomposition to avoid complex numbers, however; I did the decomposition with complex numbers.
$$\int\frac{1}{x+i}dx = ln(x+i)$$
The odd thing is that I first had a solution involving $ln(|x+i|)$. Graphing both solutions showed them to be quite dissimilar (the solution evaluates to reals). So I removed the absolute value bars from the logarithms containing an imaginary unit.
$$ln(x+i)$$
To my surprise, the graphs were equal (apart from a constant factor).
My question is why the absolute value bars are not needed, and what justifies them in the first place. I know that $ln(x), x = 0$ is undefined, but how can we justify the absolute value bars?
For reference, the exam question was to integrate the following:
$$\int \frac{dx}{x^3+2x^2+2x}$$
The solution manual uses 
$$\frac{1}{2} \ln(|x|) - \frac{1}{4} \ln(x^2+2x+2) - \frac{1}{2}\arctan(x+1) + C_1$$
Whereas my solution came to:
$$\frac{1}{2}\ln(|x|) + \frac{1}{-2i-2} \ln(x+1-i)+ \frac{1}{2i-2}\ln(x+1+i) + C_2$$
Where $i$ denotes the imaginary unit.
 A: It's unfortunate that people learn $\ln |x|$ as an antiderivative for $1/x$ in calculus, because this will not work in a complex context.  What is true in general is that $\ln (C x)$ is an antiderivative for $1/x$ where $C$ is nonzero and locally constant.  In a real-variable context, if you want to avoid logarithms of negative numbers, you can take $C$ to be negative when $x$ is negative, and positive when $x$ is positive.  This doesn't cause a problem because $x > 0$ and $x < 0$ are disjoint intervals.  There's really no reason to expect the $C$ for $x < 0$ and the $C$ for $x > 0$ to be related.
In the complex case, introducing absolute values will almost always spoil analyticity, and indeed $\ln |z|$ is not an analytic function.  The best you can say is that given any branch of $\ln$ defined on a domain $D$, $\ln(C z)$ is an antiderivative for $1/z$ on $\{z: C z \in D\}$.  
A: $\newcommand{\Ln}{\operatorname{Ln}}$
In this case you should write $\Ln(x+i)$ for the main branch of the complex logarithm. Note that
$$
\Ln(x+i)=\ln(|x+i|)+i·\arg(x+i)=\tfrac12·\ln(1+x^2)+i·(\tfrac\pi2-\arctan(x)+k·2\pi).
$$

As such, your solution further transforms to
\begin{align}
&=\frac12\ln|x|-\frac{1-i}4\Ln(x+1-i)-\frac{1+i}4\Ln(x+1+i)+C_2
\\
&=\frac12\ln|x|-\frac12\Re\Bigl((1+i)(\ln|x+1+i|+i\arg(x+1+i)\Bigr)+C_2
\\
&=\frac12\ln|x|-\frac14\ln((x+1)^2+1)+\frac12\left(\frac\pi2-\arctan(x+1)\right)+C_2
\end{align}
A: You need to think of $\ln(y)$ as a function that solves the equation $y = e^x$ for x. It becomes readily apparent that there are an infinite amount of possible solutions for a complex x, as euler's formula states:
$$ e^{ix} = \cos(x) + i\sin(x) $$
This implies that any multiple of the imaginary unit will have its real part plus a full cycle: ($n \in \mathbb{Z}$)
$$ x = ln|y| + 2i n\pi $$
For any negative y, you need to rotate in the complex plane by 180 degrees, this means an odd multiple of pi:
$$ y \in \mathbb{R^-} \Rightarrow x = ln|y| + (2n-1)i\pi \Rightarrow |y|e^{(2n-1)i\pi} = -|y| $$
Taking any integral on the negative side of the $x^{-1}$ function from a to b, where $a < b$, results in the following:
$$(ln|b| + (2n-1)i\pi) - (ln|a| + (2n-1)i\pi)$$
$$ \Rightarrow ln|b| - ln|a| $$
Peculiar occurrences happen when taking the integral over the interval where it is discontinuous (at zero):
$$ \int_{-a}^a x^{-1}dx, a \in \mathbb{R^+} = (ln(a) + 2in\pi) - (ln(a) + i(2n-1)\pi)$$
$$ = 2in\pi - 2in\pi + i\pi = i\pi $$
This answer makes no sense, and is invalid as it was integrated over a discontinous interval (hence not Riemann integrable). To remedy this problem, you need to observe that $x^{-1}$ is an odd function. Using our intuition we observe that any areas generated by the negative side of the graph will cancel out an equal portion on the right side. Hence, to allow the answer to make sense we can take the absolute values.
$$ \int_{-a}^a x^{-1}dx, a \in \mathbb{R^+} = ln|a| - ln|a| = 0$$
The reason absolute value bars are invalid for complex numbers is because the point never passes through zero (and thus gives us no excuse to look at symmetry, as there is no symmetry):
$$ \int_{-a}^a (x+i)^{-1}dx, a \in \mathbb{R^+} $$
$(x+i)^{-1}$ is fully Riemann integrable, as the function is continuous for all $x \in \mathbb{R}$.
Conclusion: the reals of $x^{-1}$ is discontinuous at zero, and special care must be taken. We exploit symmetry to construct the correct expression for the area.
