$f \in L^1$, but $f \not\in L^p$ for all $p > 1$

For $x\in (0,1), $ define

$$f(x) = \frac{1}{x(|\ln x|+1)^2}.$$

Then $f \in L^1(0,1),$ but $f \notin L^p(0,1)$ for all $p>1.$


Consider $r>0$, and notice that $x^{-r}$ is in $L^p$ for each $p<1/r$ and is not in $L^p$ for each $p \geq 1/r$.

In view of that, consider a sequence $\{ r_n \}_{n=1}^\infty$ increasing to $1$ (e.g. $r_n=1-2^{-n}$). Now for any summable sequence $c_n$ of strictly positive numbers, the function

$$f(x)=\sum_{n=1}^\infty c_n x^{-r_n}$$

will not be in any $L^p$ with $p>1$, since one can pick $n(p)$ with $r_{n(p)} \geq 1/p$, and then $|f(x)| \geq c_{n(p)} x^{-r_{n(p)}}$. To make $f$ be in $L^1$, we need not only that $c_n$ is summable but also that $\sum_{n=1}^\infty \frac{c_n}{1-r_n}<\infty$. So for instance $c_n=(1-r_n)2^{-n}$ will suffice. If you stick with the choices I have mentioned then you get the nice expression

$$f(x)=\sum_{n=1}^\infty 4^{-n} x^{-1+2^{-n}}.$$