Skip to content

Clean up loggers: remove make_logger, use standard logging#6888

Open
edgarcosta wants to merge 1 commit intoLMFDB:mainfrom
edgarcosta:cleanup-loggers
Open

Clean up loggers: remove make_logger, use standard logging#6888
edgarcosta wants to merge 1 commit intoLMFDB:mainfrom
edgarcosta:cleanup-loggers

Conversation

@edgarcosta
Copy link
Member

Summary

Resolves #6885. Each LMFDB module had its own logging.Logger instance created via make_logger(), resulting in 55+ redundant loggers with partially broken configuration logic (the logfocus feature in make_logger was noted in the code itself as "NEVER BE TRUE").

This PR removes make_logger() entirely and replaces all usage with standard logging.getLogger("lmfdb").

Changes

  • lmfdb/logger/utils.py: Removed the make_logger() function. LmfdbFormatter is retained (still used by start.py).
  • lmfdb/logger/__init__.py: Removed make_logger from imports and __all__.
  • lmfdb/logger/start.py: Removed dead logfocus code that set levels on per-module named loggers no longer in use.
  • 75 files across the codebase: Removed all from lmfdb.logger import make_logger imports and make_logger() calls.
    • 38 files had loggers that were created but never used — these were simply deleted.
    • 20 files that actively use their logger were updated to 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 in start.py with the appropriate formatter and level. This is equivalent to using app.logger (since Flask names it after app.import_name), but uses standard Python logging to avoid circular import issues.

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
@roed314
Copy link
Member

roed314 commented Feb 21, 2026

Oops, see #6889.

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.

Clean up loggers

2 participants