Doesnt truncate log file in debug mode