Michelle Beard created SENSSOFT-120:
---------------------------------------
Summary: Python logging module interferes with other applications
logging
Key: SENSSOFT-120
URL: https://issues.apache.org/jira/browse/SENSSOFT-120
Project: SensSoft
Issue Type: Bug
Components: UserALE.PyQt5
Affects Versions: UserALE.PyQt5 0.1.5
Reporter: Michelle Beard
Assignee: Michelle Beard
Fix For: UserALE.PyQt5 0.1.6
We found a bug in UserALE logging that seems to be a very simple fix. In fact,
I have attached a modified version of ale.py which I believe addresses the
issue.
The issue arises when UserALE is used to instrument a program which also
utilizes the python logging module. Since UserALE leverages the
logging.baseConfig() functionality, it shares the root logger in that module
with any other part of the program which performs logging. Therefore any
modifications to the root logger affect output everywhere it is utilized. This
cropped up in ImageMagickGUI. The real issue is with logging.baseConfig(): if
any handlers are set up for the root logger prior to a call to baseConfig(),
the subsequent call is ignored. To prevent this overlap, I created a new logger
object in ale.py and gave it all the attributes of the original logger. I
additionally set it to ignore the logger hierarchy in the logging module, so
that the UserALE output doesn’t propagate to other loggers. Preliminary testing
suggests that this has rectified the issue without removing functionality or
introducing features.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)