They are still equal up to a constant (as usual with integration), since
by the laws of logarithms.
Another nice example of this phenomenon is $\int\sin x\cos x\,dx$, which can work out to be $-\frac14\cos2x$ (if you apply the trigonometric identity for $\sin2x$) but also $-\frac12\cos^2x$ working another way (by parts). Indeed, you should be able to find a constant $C$ such that $-\frac14\cos2x = -\frac12\cos^2x+C$ for all $x$ (by applying an appropriate trigonometric identity).
Why can you get different answers?
Remember that when you "work out" $\int f(x)\,dx$, what you're actually doing is searching for a primitive, i.e., function $F$ which satisfies $F'(x) = f(x)$. These are not uniquely determined, i.e., there are many possible functions $F$ with the property $F'=f$, but you can prove (using the mean-value theorem) that any two primitives must be equal up to a constant. (This should make sense intuitively because a constant only shifts the graph of $y=f(x)$ up and down, which does not affect the gradient of the tangent at any point).