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

Let $X$ be the interval $[0,1]$ with Lebesgue measure. Is there a function $f\in L^p(X)$ for all $p\in[1,\infty)$ that is not $\in L^\infty(X)$? If so, what is an example?

Motivation: In a course on measure theory this fall, I've learned proofs that $L^p(X)\supset L^q(X)$ if $q>p$ and that if $f\in L^\infty(X)$, then $\|f\|_\infty = \lim \limits_{p\to\infty} \|f\|_p$. This prompted me to wonder if $L^\infty(X) = \bigcap _p L^p(X)$. A classmate gave me a general theoretical reason to believe the contrary: $L^p(X)$ is a reflexive space for $1 \lt p \lt \infty$ but not for $p=1,\infty$; but intersections of reflexive spaces are reflexive. This logic seems sound to me; but it implies the containment $L^\infty(X) \subset \bigcap_p L^p(X)$ is strict. If so, there must be a function that is $L^p$ for all $p$ but not a.e. bounded. What is it?


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.