Skip to content

Commit

Permalink
Bugfix #2830 main_v6.0 fix missing log output (#2840)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemccabe authored Dec 18, 2024
1 parent 26defe1 commit 1e95e44
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions metplus/util/config_metplus.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@ def __init__(self, conf=None, run_id=None):
super().__init__(conf)
self._cycle = None
self.run_id = run_id if run_id else str(uuid.uuid4())[0:8]
# if run ID is specified, this is a copy of a config
self.is_copy = run_id is not None
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
Expand All @@ -475,6 +477,9 @@ def __init__(self, conf=None, run_id=None):

def __del__(self):
"""!When object is deleted, close and remove all log handlers"""
# do not close log handlers if this is a copied config object
if self.is_copy:
return
handlers = self.logger.handlers[:]
for handler in handlers:
self.logger.removeHandler(handler)
Expand Down

0 comments on commit 1e95e44

Please sign in to comment.