Davide M. answered 02/20/21
PhD in Mathematics, former UCLA Researcher: Math and Physics Tutor
The integral of 1/x dx is the absolute value of the logarithm of x. It will be a mistake saying that the integral of 1/x dx is log(x). The reason of the presence of the absolute value is exactly to avoid the argument of the logarithm to be negative.
Hence, the correct sequence of equalities will be dx/x = -dx/-x ⇒ ln |x| = ln |-x| and in this case you will not have problems related to x being negative.
Best,
Davide