Fix generation of blank log files when TEST_MODE is true