Skip to content

Stop reconfiguring the root logger when importing DQX#1359

Merged
mwojtyczka merged 5 commits into
databrickslabs:mainfrom
SreeramaYeshwanthGowd:fix/1136-root-logger-reconfigure
Jul 24, 2026
Merged

Stop reconfiguring the root logger when importing DQX#1359
mwojtyczka merged 5 commits into
databrickslabs:mainfrom
SreeramaYeshwanthGowd:fix/1136-root-logger-reconfigure

Conversation

@SreeramaYeshwanthGowd

@SreeramaYeshwanthGowd SreeramaYeshwanthGowd commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Changes

Importing anything from DQX currently reconfigures the Python root logger, because src/databricks/labs/dqx/__init__.py calls blueprint's install_logger() at import time, which removes all existing root handlers and installs its own. That overwrites the logging setup of any application using DQX as a library (see #1136).

This changes the package import to leave the root logger alone. Following standard library logging practice, it attaches a NullHandler to the databricks.labs.dqx logger instead of installing a handler on the root logger. The CLI is unaffected; it configures logging separately via get_logger / install_logger in cli.py and installer/logs.py.

Linked issues

Resolves #1136

Tests

  • manually tested
  • added unit tests
  • added integration tests
  • added end-to-end tests
  • added performance tests

Unit tests in tests/unit/test_logging_setup.py check that importing DQX does not remove the application's root handlers or change the root level, and that a NullHandler is attached to the databricks.labs.dqx logger.

Documentation and Demos

  • added/updated demos
  • added/updated docs
  • added/updated agent skills

@SreeramaYeshwanthGowd
SreeramaYeshwanthGowd requested a review from a team as a code owner July 22, 2026 11:22
@SreeramaYeshwanthGowd
SreeramaYeshwanthGowd requested review from pratikk-databricks and removed request for a team July 22, 2026 11:22
@SreeramaYeshwanthGowd
SreeramaYeshwanthGowd force-pushed the fix/1136-root-logger-reconfigure branch from f84617d to ff49bd3 Compare July 22, 2026 11:34
@mwojtyczka mwojtyczka added the under-review This PR is currently being reviewed by one of DQX maintainers. label Jul 23, 2026

@mwojtyczka mwojtyczka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mwojtyczka mwojtyczka added Approved to Merge When PR is reviewed and approved. To be merged once all tests pass and removed under-review This PR is currently being reviewed by one of DQX maintainers. labels Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved to Merge When PR is reviewed and approved. To be merged once all tests pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Python Root Logger is Reconfigured When Importing DQX

2 participants