Better log file handling