Commits

buzmakov  committed 2a25d00 Draft

fixing dublicating logging bug

  • Participants
  • Parent commits 9cff618

Comments (0)

Files changed (3)

 * Добавть отображение размера загружаемых файлов
 * матрица коэффициентов SART может быть неоднородной
 * код spmd  и opencl одной функцией
-
+* сжатие hdf5

File tomofrontend/profiles/tomo_reconstructor.py

 
     log_file = os.path.join(res_folder, 'tomo.log')
 
-    add_logging_file(log_file)
+    logger_handler=add_logging_file(log_file)
 
     h5_postprocess_file = preprocess_and_save_all_data(data_root, res_folder, tomo_profile)
 
         save_amira(h5_result_file)
         make_images(h5_result_file)
 
+    logging.getLogger('').removeHandler(logger_handler)
+
 if __name__=="__main__":
     set_logger()
     parser = optparse.OptionParser("Usage: %prog [options]")

File utils/mylogger.py

     logging.getLogger('').addHandler(console_logger)
 
 
-def add_logging_file(log_file):
-    logger = logging.getLogger('')
-    my_log = logging.FileHandler(log_file, mode='w')
+def add_logging_file(log_file,logger_id=None):
+    if logger_id is None:
+        logger_name=''
+    else:
+        logger_name=str(logger_id)
+    logger = logging.getLogger(logger_name)
+    my_log_handler = logging.FileHandler(log_file, mode='w')
     #formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
     formatter = logging.Formatter("%(asctime)s - %(message)s")
-    my_log.setFormatter(formatter)
-    logger.addHandler(my_log)
-    logger.setLevel(logging.INFO)
+    my_log_handler.setFormatter(formatter)
+    logger.addHandler(my_log_handler)
+    logger.setLevel(logging.INFO)
+    return my_log_handler