An unbounded function with integrability for all p>0 How to construct a function $f\geq0$ such that i) $f\in L^p([0,1])\forall p>0$ and ii) $esssup_I f=+\infty$ for any interval $I\subset[0,1]$ ?
Thank you! 
 A: How about 
$$
f(x)=|\log x|?
$$
The above is a wrong answer, since it does not fulfill 3. So let's try again.
If $0<a<1$, then
$$
\int_0^1|\log |x-a||\,dx=1 - (1 - a) \log(1 - a)- a \log a<2.
$$
Order the rationals in $[0,1]$ in a sequence $\{a_n\}$, let $f_n(x)=\bigl|\,\log |x-a_n|\,\bigr|$ and
$$
f(x)=\sum_{n=1}^\infty2^{-n}f_n(x)\ .
$$
Clearly $f$ is positive. Moreover
$$
\int_0^1f(x)\,dx=\sum_{n=1}^\infty2^{-n}\int_0^1f_n(x)\,dx\le2 \sum_{n=1}^\infty2^{-n}<\infty,
$$
so that $f$ is finite almost everywhere and in $L^1$. We have to check that $f\in L^p$ for $p>1$. Since 
$$
\|f\|_p\le\sum_{n=1}^\infty2^{-n}\|f_n\|_p,
$$
it is enough to show that $\|f_n\|_p\le C_p$ for some constant $C_p$ depending only on $p$. The function $|x-a|^{1/(2p)}\bigl|\,\log |x-a|\bigr|$ is continuous, and in particular bounded, as a function of $(x,a)$ on $[0,1]\times[0,1]$. It follows that there exists a constant $C_p$ such that
$$
\bigl|\,\log |x-a|^p\bigr|\le\frac{C_p}{\sqrt{|x-a|}},\quad0\le x\le1,\quad0\le a\le1,
$$
and the claim follows.
A: Let 
$$\mathbb{Q}\cap [0,1]=\left\{x_n\right\}_{n\in \mathbb{N}} $$
and
$$f_n(x)=-\log|x-x_n| $$
so that $f_n\geq0$, $f_n\in L^p(0,1)$ for all $p\in (0,\infty)$, and
$$\|f_n\|_p^p=\int_0^1|f_n|^p=\int_{0}^{1}|\log|x-x_n||^pdx \leq\int_{-1}^{1}|\log |x||^pdx=:C<\infty$$
Let
$$f=\sum_{n\in \mathbb{N}}\frac{1}{2^n}f_n $$
then by Minkowski's inequality and Minkowski's inequality for $p\in (0,1)$, we have
$$\|f\|_p\leq \max\left\{2^{\frac{1}{p}-1};1\right\}\sum_{n\in \mathbb{N}}\frac{1}{2^n}\|f_n\|_p\leq \max \left\{2^{\frac{1}{p}-1};1\right\}C^{1/p}\sum_{n\in \mathbb{N}}\frac{1}{2^n}<\infty $$
Hence $f\in L^p$ for all $p\in (0,\infty)$, and for any interval $I\subset [0,1]$, there is $n\in \mathbb{N}$ such that $x_n\in I$, and so $$\operatorname{ess\,sup}f\geq \operatorname{ess\,sup}f_n=+\infty$$
