log add flush when exit