Integrability of log of distance function

The integral in question is finite for most sets of measure zero, but can diverge to $\infty$ for some sets. An example in one dimension is obtained by constructing a Cantor set where at stage $k$ the middle $1/(k+1)$ proportion is removed from each of the $2^{k-1}$ intervals obtained at stage $k-1$. Thus the $2^k$ intervals obtained at stage $k$ will each have length $2^{-k}/(k+1)$. Therefore, each of the $2^k$ middle intervals removed in the next stage will have length $2^{-k}/[(k+1)(k+2)]$, and each of these will contribute at least $k/2$ times its length to the integral. Summing over $k$ gives a harmonic series which diverges. The example can be lifted to higher dimensions by taking a Cartesian product with a $n-1$ dimensional box.


If $E\ne\emptyset$, then $d(x,E)\le2$ for all $x\in B_1(0)$. So, your integral is $\le\lambda(B_1(0))\ln2<\infty$.