Let $f_{n,K}$ denote a kernel estimator of a density f in $\R$ such that $\int_\R f ^p(x)\d x \infty$ for some p>2. It is shown, under quite general conditions on the kernel K and on the window sizes, that the centred integrated squared deviation of $f_{n,K}$ from its mean, $\|f_{n,K}-\E f_{n,K}\|_2^2-\E\|f_{n,K}-\E f_{n,K}\|_2^2$ satisfies a law of the iterated logarithm (LIL). This is then used to obtain an LIL for the deviation from the true density, $\|f_{n,K}-f\|_2^2-\E\|f_{n,K}-f\|_2^2$ . The main tools are the Komlós-Major-Tusnády approximation, a moderate-deviation result for triangular arrays of weighted chi-square variables adapted from work by Pinsky, and an exponential inequality due to Giné, Latała and Zinn for degenerate U-statistics applied in combination with decoupling and maximal inequalities.