spacetelescope / jwst

Python library for science observations from the James Webb Space Telescope
https://jwst-pipeline.readthedocs.io/en/latest/
Other
570 stars 167 forks source link

remove unsupported `end` from ami logs and remove MultilineLogger #8550

Closed braingram closed 3 months ago

braingram commented 5 months ago

jwst.associations.lib.log_config globally sets the logging class to MultilineLogger which can cause seemingly unrelated tests to fail: https://github.com/spacetelescope/stpipe/actions/runs/9445531594/job/26087417184#step:10:189

The failure revealed a bug in the ami log messages (end is not a supported kwarg for these calls).

This PR also removes MultilineLogger and the global call to setLoggerClass.

This class was added in the "inital commit": https://github.com/spacetelescope/jwst/commit/5915b0e919be1e3393fd0ba74ff9106de77a4a1e#diff-9e38d1ac7b11ff469184d069a47776082c49c376e91e3b8dbb9e3b3872a6627bR177 and will change other logging if the association module is imported. For example:

import jwst.associations.lib.log_config
import logging

logger = logging.getLogger("foo")
logger.warning("bam\nbar")

produces:

2024-06-15 12:58:48,873 - stpipe - WARNING - bam
2024-06-15 12:58:48,873 - stpipe - WARNING - bar

removing import jwst.associations.lib.log_config produces:

bam
bar

(note the rather extensive log formatting that stpipe introduces, this is not part of this PR). With this PR the output (with the jwst.association.lib.log_config) is:

2024-06-15 13:00:52,386 - stpipe - WARNING - bam
bar

(and the same if jwst.associations.lib.log_config is not imported).

Fixes https://github.com/spacetelescope/jwst/issues/6407 and is an alternative to https://github.com/spacetelescope/jwst/pull/7616

Regression tests running at: https://plwishmaster.stsci.edu:8081/job/RT/job/JWST-Developers-Pull-Requests/1534/

Checklist for PR authors (skip items if you don't have permissions or they are not applicable)

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 58.63%. Comparing base (dba65ae) to head (a7deded). Report is 223 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #8550 +/- ## ======================================= Coverage 58.63% 58.63% ======================================= Files 391 391 Lines 39081 39081 ======================================= Hits 22914 22914 Misses 16167 16167 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.