A function that is bounded and measurable but not Lebesgue integrable

Let $f : \Bbb R \to \Bbb R$ be defined as:

$$f(x) = \begin{cases} 1 & x \in [0, \infty) \\ 0 & \text{else} \end{cases}.$$ Clearly, $f$ is measurable since $f = \chi_{[0, \infty)}$ (and $[0, \infty)$ is a Lebesgue measurable set, so its characteristic function is measurable).

Also clearly $f$ is bounded. But $\int \limits_{\Bbb R} |f| \,dm = \infty$.


This happens exactly when the integral of the positive part and the integral of the negative part are both infinite. One nice example is

$$\int_1^\infty \frac{\sin(x)}{x} dx$$

which exists in the improper Riemann sense and not in the Lebesgue sense. A more extreme example where this is easier to prove would be

$$\int_0^\infty \sin(x) dx.$$