logarithms are only defined for positive arguments: loga(x) is the inverse to ax and (for a positive) ax is always positive.
But d(ln(x))/dx= 1/x for x positive, and using the chain rule, d(ln(-x))/dx= (1/(-x))(-1)= 1/x with x negative. Thus: the anti-derivative for ln(x) is properly ln|x|+ C rather than ln(x)+ C.
I will confess that I always forget the "| |" myself. Most of the time it doesn't matter: [itex]\int_a^b (1/x)dx= ln b- ln a[/itex] if a and b are both positive,
ln(|b|)- ln(|a|)= ln(-b)- ln(-a) if a and b are both negative so you can just 'ignore' the negative signs. Of course, 1/x is not defined for x= 0 and the integral is not defined if a is negative and b positive.