Improved performance for file logging