Optimizate log file flush