Skip to content

fix: replace global basicConfig with NullHandler#112

Open
Baho73 wants to merge 1 commit intorendrom:masterfrom
Baho73:fix/logging-global-basicconfig
Open

fix: replace global basicConfig with NullHandler#112
Baho73 wants to merge 1 commit intorendrom:masterfrom
Baho73:fix/logging-global-basicconfig

Conversation

@Baho73
Copy link
Copy Markdown

@Baho73 Baho73 commented Feb 18, 2026

Summary

  • Replaces logging.basicConfig(filename="debug.log", level=logging.DEBUG) with logging.NullHandler()
  • The basicConfig() call in logger.py overrides the root logger for any application that imports rosreestr2coord, silently redirecting all logs to a debug.log file
  • NullHandler is the recommended approach for library logging in Python

Fixes #93

Before

import rosreestr2coord
# All application logs now go to debug.log instead of console

After

import rosreestr2coord
# Application logging is unaffected
# Users can configure rosreestr2coord logging explicitly if needed:
# logging.getLogger("rosreestr2coord").setLevel(logging.DEBUG)

Test plan

  • Importing rosreestr2coord no longer creates debug.log
  • Application logging remains unaffected after import
  • Library internal logging still works when explicitly configured

logging.basicConfig() in a library overrides the root logger configuration
of any application that imports rosreestr2coord, redirecting all logs
to debug.log. This is against Python logging best practices for libraries.

Replace with NullHandler as recommended by the Python docs:
https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library

Fixes rendrom#93

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

Логирование перекрывает настройки всей программы

1 participant