I wanted to compute the electric potential of an infinite charged wire, with uniform linear density $\lambda$.
I know that the potential can easily be calculated using Gauss law, but I wanted to check the result using the horrifying integral (assuming the wire is in the $z$ axis) \begin{align} &\phi({\bf r})=\int_{-\infty}^{+\infty}dz' \frac{\lambda}{\sqrt{x^2+y^2+(z-z')^2}} \end{align}
The antiderivative of the integrand is \begin{equation} g({\bf r},z')=-\lambda\log\left( \sqrt{x^2+y^2+(z-z')^2} + (z-z') \right) \end{equation}
So the potential is: \begin{equation} \phi({\bf r})=\lim_{z' \rightarrow +\infty}g({\bf r},z') -\lim_{z' \rightarrow -\infty}g({\bf r},z') \end{equation}
The first limit converges: \begin{equation} \lim_{z' \rightarrow +\infty}g({\bf r},z')= \lim_{z' \rightarrow +\infty} -\lambda\log\left( \sqrt{x^2+y^2+(z-z')^2} + (z-z') \right)= -\lambda\log(\sqrt{x^2+y^2}) \end{equation}
But the second limit diverges! \begin{equation} \lim_{z' \rightarrow -\infty}g({\bf r},z')= \lim_{z' \rightarrow -\infty} -\lambda\log\left( \sqrt{x^2+y^2+(z-z')^2} + (z-z') \right)=\infty \end{equation}
Then $\phi=\infty$, which is absurd. So, why this calculation went wrong? Thanks