You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if I want to reuse logger after call shutdown(), I can recreate log_a , add file_handler , but it will failure on log.xxx
Traceback (most recent call last):
...
File "logging.py", line 141, in info
File "logging.py", line 135, in log
File "logging.py", line 71, in emit
ValueError:
the root cause is, after execute logging.shutdown() , all logger remain in _loggers variables, so all handlers remain in logger.handlers, but the old file_handlers was closed, so emit method failure.
if I want to reuse logger after call shutdown(), I can recreate log_a , add file_handler , but it will failure on log.xxx
the root cause is, after execute logging.shutdown() , all logger remain in _loggers variables, so all handlers remain in logger.handlers, but the old file_handlers was closed, so emit method failure.
we can run follow code to verify it.
to fixed it, pass name to pop method in line 213
logging._loggers.pop(logger.name, None)
The text was updated successfully, but these errors were encountered: