close the logging correctly
diff --git a/turbo_hipster/lib/utils.py b/turbo_hipster/lib/utils.py
index bff5206..71286d7 100644
--- a/turbo_hipster/lib/utils.py
+++ b/turbo_hipster/lib/utils.py
@@ -103,7 +103,7 @@
if not os.path.isdir(os.path.dirname(logfile)):
os.makedirs(os.path.dirname(logfile))
- logger = logging.getLogger('execute_to_log')
+ logger = logging.getLogger(logfile)
log_hanlder = logging.FileHandler(logfile)
log_formatter = logging.Formatter('%(asctime)s %(message)s')
log_hanlder.setFormatter(log_formatter)
@@ -181,6 +181,9 @@
pass
logger.info('[script exit code = %d]' % p.returncode)
+ logger.removeHandler(log_hanlder)
+ log_hanlder.flush()
+ log_hanlder.close()
def push_file(job_unique_number, file_path, publish_config):