flush when logging