Add cleanup logging to debug mode.