Is the integral of $\frac{1}{x}$ equal to $\ln(x)$ or $\ln(|x|)$?
Strictly speaking, any function of the form $$F(x) = \begin{cases} \ln x + c_1 & \text{if } x > 0, \\ \ln (-x) + c_2 & \text{if } x <0 \end{cases}$$ defined over $\mathbb R \setminus \{0\}$ is a valid antiderivative. Verify this by differentiating $F(x)$ and getting $F'(x) = 1/x$ back for any $x \ne 0$.
The usual formula, $\ln\lvert x\rvert + c$, is what you get when you pick $c_1 = c_2 = c$. Alternatively, as @Joe says, when you're only considering positive $x$, you can just write $\ln x + c$.
In general, it is safe to always write:
$$\int \frac{1}{u} \ du = \ln \left| u \right| +C $$ where $C$ is some constant.
However, if the function is always positive $\forall x \in \Bbb R\setminus \{0\}$ (assuming that's what you're integrating over), you can drop the absolute value.
Addendum of Complex Logarithm
I think this will be helpful since you wanted to know how to integrate with the complex log. Also, this should be a good read. I'd start around page 74 for what you're looking for.
I feel it might help to note that if we say $\log z$ is any logarithm along some branch $B$, then $(\log z)' = \dfrac{1}{z} \forall z$ not on $B.$ However, no matter how we define the complex logarithm, there will always be some branch that is not holomorphic.
Equal to $\ln(|x|)$+c, in which $c$ is constant.
The correct answer is$\int \frac1x dx= \ln |x| +C$
The absolute value is sometimes omitted in ODE problems. As for guidelines I would say analyze the problem and see if values of x will be out of the domain when solved.