For any $a>0$ and any real number $r \neq -1$, we have
$$\int_a^x t^r dt = \frac{x^{r+1}}{r+1}-\frac{a^{r+1}}{r+1}$$
Now we can’t plug in $r=-1$ into the formula above, because we’d get zero in the denominator. But we can take the limit:
$$\lim_{r \rightarrow -1}\int_a^x t^r \, dt = \lim_{r \rightarrow -1}\frac{x^{r+1}-a^{r+1}}{r+1}=\ln(x)-\ln(a) = \int_a^x t^{-1} dt = \int_a^x \lim_{r \rightarrow -1} t^r \, dt$$
My question is, why was it possible to interchange the limit and integral here?
Is $t^r$ uniformly convergent to $t^{-1}$ as $r$ goes to $-1$? That would be one possible cause of being able to interchange limit and integral (though there are others).
I think you can apply the Arzela-Ascoli theorem here. Take a function sequence $\{f_n\}$ with $ f_n(t) = t^{r_n} $ defined on $[a,x]$ with $ r_n \rightarrow -1 $ monotonly. Obviously, it is uniformly bounded. So are the derivatives $\{f_n'(t)\}$ which means that $\{f_n\}$ is equicontinous. Due to Arzela-Ascoli we then get uniform convergence of at least a subsequence of $\{f_n\}$. However, one should easily be able to show the uniform convergence of the whole sequence using the monotony of the values $\{ f_n(t) \}_{n \in \mathbb{N}} $ at each point $ t \in [a,x] $.
Herefor, you can interchange integral and limit if you restrict to a concrete sequence $r_n$ as above. The generalization to continous $r$ should be possible by again exploiting the monotony properties w.r.t. $r$.
Edit: Details to the continuous case
Let $r_n \rightarrow -1$ be monotonly decreasing and wlog $r_n<0$ . Then for each $t \in [a,x]$, $f_n(t) = t^{r_n}$ is monotonly increasing. So for an arbitrary $r \in (-1,r_1)$ there is an $n$ such that $r_n >=r >= r_{n+1} $. Therefore, we get $f_n(t) > t^r > f_{n+1} $ and hence
$ \int_a^x f_n(t) dt > \int_a^x t^r dt > \int_a^x f_{n+1} dt $
which implies the continuous convergence for $r>-1$. Analogously, this can be done for $r<-1$.