Revised log file handling