Find electric potential due to line charge distribution? I need help how to set up this integral
$$V(\mathbf r)=\frac{1}{4\pi\epsilon_0} \int_L \frac{\rho'_l}{\lvert \mathbf r - \mathbf{r'} \rvert}\mathrm{d}l'. 
$$
I have a uniform line charge along the $z$-axis and want to calculate the electric potential between two points $A=(r_A,\phi_A,0)$ and $B=(r_B,\phi_B,0)$ (cylindrical coordinates).
Solution:
The line charge is aligned along the $z$-axis and the the source vector is 
$\mathbf{r}=z\hat{\mathbf z}$ and the field vector is 
$\mathbf{r'}=r'\hat{\mathbf r}+z'\hat{\mathbf z}$
so $$\lvert \mathbf{r}-\mathbf{r'} \rvert=\sqrt{(r')^2+(z-z')^2}.$$
I integrate along $z'$ from $-\infty$ to $\infty$
\begin{align}
V(\mathbf r) &=\frac{1}{4\pi\epsilon_0} \int_L \frac{\rho'_l}{\lvert \mathbf r - \mathbf{r'} \rvert}\mathrm{d}l' \\
&=\frac{\rho_l}{4\pi\epsilon_0} \int_{-\infty}^{\infty}\frac{1}{\sqrt{(r')^2+(z-z')^2}}\mathrm{d}z'\\
&=\frac{1}{4\pi\epsilon_0} \big [ \ln(z-z'+\sqrt{(r')^2+(z-z')^2})\big ]^{\infty}_{-\infty}\\
&= -\infty +\infty
\end{align}
The integral is indeterminate and I'm stuck here. 
Are the vectors wrong, the limits? What have I missed?
Thanks!
If I calculate the line integral of the electric field I find the correct potential (however, I want to calculate with the integral above).

I integrate in the radial direction $\mathrm{d}\mathbf{r}$ from $r_A$ to $r_B$. The electric field is $\mathbf{E}(\mathbf{r})=\frac{\rho_l}{2\pi\epsilon_0 r}\hat{\mathbf{r}}$ so
\begin{align}V(\mathbf{r})&=-\int_L \mathbf{E}(\mathbf r) \cdot \mathrm{d}\mathbf{l}\\&=\frac{\rho_l}{2\pi\epsilon_0}\int_{r_A}^{r_B}\frac{1}{r}\mathrm{d}r=\frac{\rho_l}{2\pi\epsilon_0}\ln{\frac{\rho_B}{\rho_A}}\end{align}

 A: Well actually, even if the general integral formula does not work since the charge is infinitely extended as correctly pointed out in the other answer, there is a way out using a suitable cutoff and a, say, renormalization procedure. Integrate from $-L$ to $L$ instead of from $-\infty$ to $+\infty$.
\begin{align}
V(\mathbf r) &=\frac{1}{4\pi\epsilon_0} \int_{[-L,+L]} \frac{\rho'_l}{\lvert \mathbf r - \mathbf{r'} \rvert}\mathrm{d}l' \\
&=\frac{\rho_l}{4\pi\epsilon_0} \int_{-L}^{+L}\frac{1}{\sqrt{(r')^2+(z-z')^2}}\mathrm{d}z'\\
&=\frac{1}{4\pi\epsilon_0} \left[ \ln \left|z-z'+\sqrt{(r')^2+(z-z')^2}\right|\right]^{+L}_{-L}\\
&= -\frac{\rho_l}{4\pi\epsilon_0} \ln \frac{r^2}{2L^2} + O(1/L)
\end{align}
The result, using $\ln(a^n) = n \ln a$ and $\ln(a/b)= \ln a - \ln b$ can be re-written as
$$V(r)=  -\frac{\rho_l}{2\pi\epsilon_0} \ln \frac{r}{\ell} + O(\ln (L/\ell))$$
for an arbitrarily  fixed length unit $\ell$. We now renormalize the result just by dropping the final divergent term $ O(\ln(L/\ell))$ obtaining
$$V(r)=  -\frac{\rho_l}{2\pi\epsilon_0} \ln \frac{r}{\ell}$$
where you see that the so-called finite-renormalization ambiguities are all encapsulated in the arbitrary  length scale $\ell$. However 
the gradient of the found function is not affected by the arbitrary choice of $\ell$.
If you compute (minus) the gradient of the found $V$ you have the correct electric field also obtained by Gauss law and symmetry arguments:
$$\mathbf{E}(\mathbf{r})=\frac{\rho_l}{2\pi\epsilon_0 r}\hat{\mathbf{r}}\:.\tag{1}$$
There is a physical interpretation of the outlined procedure. You may consider a class of charged segments of length $L_n$ with $L_n \to + \infty$ as $n\to +\infty$ and compute $V_{L_n}({\bf r})$ for every $L_n$ where ${\bf r}$ is a fixed point in space. The crucial observation is that, since the potential is always defined up to an additive constant, at each step you can re-define $V_{L_n}$ subtracting a constant $C_n$ which logarithmically diverges as $L_n\to +\infty$. This limit procedure leads to the result found above.
There is no way to avoid the introduction of the arbitrary scale $\ell$ because the functional form of the electric field (1) says that any potential function producing it as gradient must have a logarithmic form. However the problem is that the argument of the logarithm is $r$ which has the dimension of a length. So, to make this argument dimensionless, one is forced to fix some scale $\ell$ arbitrarily which, however does not affect the electric field as it disappear when computing the derivative.
A: This is a very good question, and I'm glad it's on stack exchange now. I have a couple of comments first, but you are right that the integral diverges.
Comments: 
First, it should be that the field vector $\mathbf{r}=r\hat{\mathbf r}+z\hat{\mathbf z}$, and the source point is given by $\mathbf{r'}=z'\hat{\mathbf z}$. Then, 
$$\lvert \mathbf{r}-\mathbf{r'} \rvert=\sqrt{r^2+(z-z')^2}.$$
Now, let the charge per unit length of the wire be $\rho_l=\frac{dq}{dz'}$. Then, 
\begin{align}
V(\mathbf r)&=\frac{1}{4\pi\epsilon_0} \int_L \frac{\rho'_l}{\lvert \mathbf r - \mathbf{r'} \rvert}\mathrm{d}l'\\
&=\frac{1}{4\pi\epsilon_0} \int_{-\infty}^{\infty} \frac{\rho_l}{\sqrt{r^2+(z-z')^2}}\mathrm{d}z'
\end{align}
which indeed diverges. 
Why the integral diverges:
Now, unless you are particularly astute it is rather difficult to see why. The reason is because the form of the potential which you have in your first equation is only true when the surface bounding the charge distribution is at infinity. See, the form of for $V(\mathbf{r})$ that you are using is arrived at by finding an integral solution to the equation 
$$\nabla^2 V =-\frac{\rho}{\epsilon_0},$$
which is known as poisson's equation. Upon clever usage of one of many of Greene's theorems, divergence theorem, and other multivariable calculus big hitters, one finds that the most general "solution" (in quotations to appease the pedants) to this is given by
$$V(\mathbf r)= \frac{1}{4\pi\epsilon_0}\int_V\frac{\rho(\mathbf r')}{|{\mathbf r-\mathbf r'}|}d^3r' + \frac{1}{4\pi}\oint_S\left(\frac{1}{\mathbf |\mathbf r -\mathbf r'|}\frac{\partial V}{\partial n'}-V\frac{\partial}{\partial n'}\frac{1}{\mathbf |\mathbf r -\mathbf r'|}\right)da' $$
where $S$ is the surface bounding the volume $V$, and $n'$ is the normal pointing away from the volume $V$. Now, for reasonable, non-infinite charge distributions, surface $S$ bounding $V$ is taken to be at $\mathbf r\rightarrow \infty$, which makes the quatity $\frac{1}{\mathbf |\mathbf r -\mathbf r'|}\rightarrow 0$ and $V(\mathbf r)\rightarrow 0$ (which is the reason we take $V(\mathbf r)$ to go to zero at infinity). In these cases, we get back the integral for of the potential you have in your first equation. But since your charge distribution is infinite, you actually need to take into account the term which takes the bounding surface into account. If you want me to do that I can, though this is something that is usually left to graduate courses. 
