A function that is $L^p$ for all $p$ but is not $L^\infty$?

The logarithm is an example.

To see that $\log$ is in $L^p$ for each $p>0$, it suffices to see that $|\log(t)|^p<t^{-1/2}$ for $t$ sufficiently small. This follows from the fact that $\lim\limits_{t\searrow0}\;|\log(t)|t^{1/(2p)}=0$, which is a quick application of l'Hôpital's rule.

The $L^p$ norm of $\log$ happens to be $\Gamma(p+1)^{1/p}$. This can be seen by making the change of variables $t=-\log(u)$ in the integral $\Gamma(x)=\int\limits_{0}^\infty t^{x-1}e^{-t}\:dt$. So by Stirling's approximation, $\|\log\|_p$ is close to $p/e$ when $p$ is large.


For another example, observe that the series $$\sum_{n=1}^\infty n^p\frac{1}{2^n}$$ converges for any $p$ from root test since $\limsup_{n\rightarrow \infty} \left(\frac{n^p}{2^n}\right)^{1/n} = \frac{1}{2} < 1$.

You can define the function $$f(x) = \sum_{n=1}^\infty n\chi_{(2^{-n}, 2^{-n+1}]}(x)$$ as an example.