Silly question I should know the answer to, but what is the integral of:
$$\int_{-\infty}^{\infty}\frac{1}{(x-a)}dx$$
I can use countour integrals to get one type of answer: $$\oint\frac{1}{(x-a)}dx = \int_{-\infty}^{\infty}\frac{1}{(x-a)}dx + \int_{arc}\frac{1}{(x-a)}dx$$
Where here I assume that I am integrating over a contour that contains the pole. Choosing a parameterized path:
$$\int_{arc}\frac{1}{(x(t)-a)}\frac{dt}{dx}dx$$ $$\int_{0}^{\pi}\frac{1}{(R e^{i t})} i R e^{i t}dx$$
$$2 \pi i = \int_{-\infty}^{\infty}\frac{1}{(x-a)}dx + \pi i \\ \int_{-\infty}^{\infty}\frac{1}{(x-a)}dx = i\pi $$
But if I solve the problem using u-substitution:
$$ u = ln(x-a) \\ du = \frac{1}{x-a}\\ \int_{-\infty}^{\infty}\frac{1}{(x-a)}dx = \int du = u = ln(x-a)|^{x\rightarrow\infty}_{x \rightarrow-\infty} = ln(\infty) - ln(-\infty)? $$
since $ln(-\infty)$ is undefined, so what is going on here?
EDIT: One of the answers points out that this integration only works when a isn't on the complex line. In the case where it is complex, (I think) we can do the following:
We breakdown our contour integral into more paths: $$\oint\frac{1}{(x-a)}dx = \int_{-\infty}^{a-\epsilon}\frac{1}{(x-a)}dx + \int_{\gamma_2(t)}\frac{1}{(x-a)}dx + \int_{a+\epsilon}^{\infty}\frac{1}{(x-a)}dx + \int_{arc}\frac{1}{(x-a)}dx$$
Were we've broken down the path along the real line into 3 pieces, which looks like the following picture:
In the limit where we take $\epsilon \rightarrow 0$ $\gamma_1$ and $\gamma_3$ combine to approach the integral alone the real line. And $\gamma_2$ can be expressed as the integral:
$$\int_{\pi}^{0}\frac{1}{(\epsilon e^{i t})} i \epsilon e^{i t}dx = -i \pi$$
which then gives us: $$\int_{-\infty}^{\infty}\frac{1}{(x-a)}dx -i \pi + i \pi = 2 \pi i\\ $$
So if it's on the complex plane the integral is $\pi i$ and its $2\pi i$ on the real plane

There are a few mistakes in your working.