[#2850] Fix duplicate ui log entries
This commit is contained in:
parent
a5bc73f0b3
commit
16da4d851e
|
@ -151,6 +151,13 @@ def setup_logger(level="error", filename=None, filemode="w", logrotate=None, twi
|
|||
)
|
||||
|
||||
handler.setFormatter(formatter)
|
||||
|
||||
# Check for existing handler to prevent duplicate logging.
|
||||
if root_logger.handlers:
|
||||
for handle in root_logger.handlers:
|
||||
if not isinstance(handle, type(handler)):
|
||||
root_logger.addHandler(handler)
|
||||
else:
|
||||
root_logger.addHandler(handler)
|
||||
root_logger.setLevel(level)
|
||||
|
||||
|
|
Loading…
Reference in New Issue