Indeed, as you said, the problem lies at endpoints, and we can split the integral in two parts.
In the first part, for , we have , hence it converges if (i.e. if ). On the other hand, we have, for the same , if and if , and in both cases this shows that the integral diverges if . Hence this part converges iff .
You can do the same on the interval by letting . This part converges iff .
Finally, the integral converges iff and .