Function $L^1_{\mathrm{loc}}(\mathbb{R})$ how we can explain that $\log|x|$ isn't defined on $\mathbb{R}$, but we have $\log|x| \in L^1_\text{loc}(\mathbb{R})$? Why isn't $\log|x|$ defined on $x=0$ but $\displaystyle \int_{-a}^a \log|x| \, dx <+\infty$?

$L^p$ spaces or $L^p_\text{loc}$ spaces only see functions up to a set of measure zero. Hence, it suffices to know a function only up to a set of measure zero to tell whether it is in $L^1_\text{loc}$. To be more precise, you actually define two functions to be the same if they only differ on a set of measure zero.
In your example you could consider the following function.
$$f(x) := \begin{cases}\log(|x|) & x\neq 0\\ 1 & x =0\end{cases}$$
This function is defined on the whole real axis and it is easy to check that it is in $L^1_{loc}$. Again, since you don't care about measure zero sets, there is not need to define your function on these sets. Thus, saying $\log|x| \in L^1_\text{loc}$ is a valid statement keeping in mind what I have explained.
