Clean up loggers: remove make_logger, use standard logging#6888
Open
edgarcosta wants to merge 1 commit intoLMFDB:mainfrom
Open
Clean up loggers: remove make_logger, use standard logging#6888edgarcosta wants to merge 1 commit intoLMFDB:mainfrom
edgarcosta wants to merge 1 commit intoLMFDB:mainfrom
Conversation
Each LMFDB module had its own logging.Logger instance created via
make_logger(), resulting in 55+ redundant loggers with complex,
partially broken configuration logic.
- Remove make_logger() from lmfdb/logger/utils.py entirely
- Remove dead logfocus code from start.py (relied on per-module
named loggers that are no longer created)
- Remove all make_logger imports and calls across 75 files
- For the ~20 files that actually use their logger, replace with
standard logging.getLogger("lmfdb")
- Remove 38 logger variables that were created but never used
All logging now goes through a single "lmfdb" logger which
propagates to the root logger configured in start.py.
Fixes LMFDB#6885
c6c06d6 to
4d7452f
Compare
Member
|
Oops, see #6889. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves #6885. Each LMFDB module had its own
logging.Loggerinstance created viamake_logger(), resulting in 55+ redundant loggers with partially broken configuration logic (thelogfocusfeature inmake_loggerwas noted in the code itself as "NEVER BE TRUE").This PR removes
make_logger()entirely and replaces all usage with standardlogging.getLogger("lmfdb").Changes
lmfdb/logger/utils.py: Removed themake_logger()function.LmfdbFormatteris retained (still used bystart.py).lmfdb/logger/__init__.py: Removedmake_loggerfrom imports and__all__.lmfdb/logger/start.py: Removed deadlogfocuscode that set levels on per-module named loggers no longer in use.from lmfdb.logger import make_loggerimports andmake_logger()calls.logging.getLogger("lmfdb").Net result: 54 insertions, 181 deletions — removing ~130 lines of unnecessary code.
How it works
All logging now goes through a single
"lmfdb"logger, which propagates to the root logger already configured instart.pywith the appropriate formatter and level. This is equivalent to usingapp.logger(since Flask names it afterapp.import_name), but uses standard Pythonloggingto avoid circular import issues.