Skip to content

Commit

Permalink
per #2245, use unique run ID to name logger instance to ensure that c…
Browse files Browse the repository at this point in the history
…oncurrent runs do not use the same logger instance
  • Loading branch information
georgemccabe committed Jul 13, 2023
1 parent 44ab5ce commit 613bb9a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions metplus/util/config_metplus.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def launch(config_list):
config.set('config', 'CONFIG_INPUT', ','.join(config_format_list))

# save unique identifier for the METplus run
config.set('config', 'RUN_ID', str(uuid.uuid4())[0:8])
config.set('config', 'RUN_ID', config.run_id)

# get OUTPUT_BASE to make sure it is set correctly so the first error
# that is logged relates to OUTPUT_BASE, not LOG_DIR, which is likely
Expand Down Expand Up @@ -450,7 +450,8 @@ def __init__(self, conf=None):
interpolation=None) if (conf is None) else conf
super().__init__(conf)
self._cycle = None
self._logger = logging.getLogger('metplus')
self.run_id = str(uuid.uuid4())[0:8]
self._logger = logging.getLogger(f'metplus.{self.run_id}')
# config.logger is called in wrappers, so set this name
# so the code doesn't break
self.logger = self._logger
Expand Down

0 comments on commit 613bb9a

Please sign in to comment.