The general real antiderivative, rarely taught in calculus courses, is
$$\int {1 \over x} \; dx = \cases{ \log x + C_1 & $x > 0$ \cr \log (-x) + C_2 & x < 0 \cr}\,,$$
where
$C_1$ and
$C_2$ are independent real constants. The independence is due to the disconnected domain over the reals. Over the complex plane, the domain is connected but there is a branch-cut discontinuity (along the negative real axis for Mathematica's Log[x]
).
In practical work, in the way the antiderivative arises, one usually has at hand a specific domain that does not contain
$0$. In such a case the independence of
$C_1$ and
$C_2$ does not arise and one may deal with the formula
$\log |x| + C$ for the antiderivative since
$|x| = x$,
$C = C_1$ or
$|x| = -x$,
$C = C_2$ according as the domain is positive or negative respectively.
Likewise, such practical work may be dealt with using the complex logarithm (such as Log[x]
in Mathematica), but the constant of integration will have to contain a term of
$-i\,\pi$ if
$x$ is negative so that the value of the antiderivative will be real. This is often inconvenient when using Mathematica in introductory calculus classes, in which students have not yet been introduced to complex functions.