Mostly, I have seen that $\int \! \frac{1}{x} \, \mathrm{d}x = \mathrm{ln}|x|+C$ is explained by saying that $\frac{\mathrm{d}}{\mathrm{d}x}\mathrm{ln}|x|=\frac{1}{x}$ and then applying the fundamental theorem of calculus.
But how can we solve $\int \! \frac{1}{x} \, \mathrm{d}x$ directly? As in without using that fact and instead directly applying integration techniques (like substitutions and such)?
You can let $x = e^u$. Then $dx = e^u \, du$ so that $$ \int \frac 1x \, dx = \int \frac {1}{e^u} e^u \, du = \int \, du = u+C = \ln x + C$$ as long as the domain of integration is a subset of $(0,\infty)$.
If the domain of integration is a subset of $(-\infty,0)$ use $x = -e^u$ instead.