Cleans up log handling.