Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues with log level retention #187

Merged
merged 5 commits into from
Nov 1, 2024
Merged

Fix issues with log level retention #187

merged 5 commits into from
Nov 1, 2024

Conversation

jdbuhler
Copy link
Collaborator

@jdbuhler jdbuhler commented Nov 1, 2024

fastspec --verbose sets the log level to DEBUG, but this level unexpectedly reverts to INFO when imports from the DESI libraries implicitly invoke get_logger(), which reset the log level. There seems to be no safe way to avoid this with desiutil.log, since it always returns the same log object that the DESI libraries themselves use internally. So, make our global 'log' object distinct from desutil's by creating it with a new domain ('fastspec').

While we're at it, make sure the log level is set in the singlecopy initialization code, so that it happens in subprocesses as well as the parent process when running in mp mode. (This isn't being exercised now because multiprocessing uses fork, but it should futureproof us against Python 3.14+, which will switch to spawn.)

Jeremy Buhler and others added 5 commits October 31, 2024 21:25
its log level changed by calls into the DESI libraries.  Create our
own logging domain named 'fastspec' instead.
* Move setting of log level into singlecopy initialization, so that
it will happen in subprocesses as well if the parent process log gets
regenerated
@moustakas
Copy link
Member

Thank you @jdbuhler!

@moustakas moustakas merged commit 2827be4 into main Nov 1, 2024
@moustakas moustakas deleted the logging branch November 1, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants