Add logging for better debugging.