I will use the following integral as a dummy exercise.
\begin{equation} \int_0^{+\infty} \frac{\ln x}{(1+x^2)^2} dx \end{equation}
I thought that the correct way to compute this kind of integrals (even when the logarithm has exponent $a\neq 1$) is to take the limit for $R\to\infty$ and $\varepsilon \to 0$ of the integral given by:
\begin{equation} \int_\Gamma \frac{\ln z}{(1+z^2)^2} dz \end{equation}
defining $\Gamma \equiv \gamma_1 + \gamma_R + \gamma_2 + \gamma_\varepsilon$, where:
- $\gamma_1(t)=t$, $t\in[0,R]$
- $\gamma_R(t) = Re^{2i\pi t}$, $t\in[0,1]$
- $\gamma_2(t)=-t$, $t\in[0,R]$
- $\gamma_\varepsilon(t) = \varepsilon e^{-2\pi i t}$, $t\in[0,1]$
This choice comes from defining the logarithm's branch cut on the positive real axis and building a path that does not cycle around the diramation point $z=0$ nor crosses the branch cut. Of course, by the Residue Theorem, the value of the integral will be: $2\pi i \sum_{j}\text{Res}(f,a_j)$, where $\{a_j\}$ are the singularities inside $\Gamma$
To hopefully clear things out:
\begin{align} \left( \int_{\gamma_R} +\int_{\gamma_1} + \int_{\gamma_\varepsilon} + \int_{\gamma_2} \right) f(z) \, dz &= 2\pi i \sum_{j} \text{Res}(f,a_j) \\ \implies \left( \int_{\gamma_1} + \int_{\gamma_2} \right) f(z) \, dz &= \left( -\int_{\gamma_R} - \int_{\gamma_\varepsilon} \right) f(z) \, dz + 2\pi i \sum_{j} \text{Res}(f,a_j) \end{align}
The integrals on the left are the ones that I wanted to compute at the beginning, but the important terms cancel out, because the only difference between numbers on the two paths is a phase: $\ln(ze^{2\pi i}) = \ln(z) + 2\pi i$.
What am I missing?
Edit: as kindly suggested in the comments, the integral I wrote above has been already solved. I think that answer that fits best with my question is this, because it follows each step clearly and suggests a general approach to logarithm integrals.