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 tweaking logging levels #428

Closed
wants to merge 1 commit into from
Closed

Conversation

seblu
Copy link
Contributor

@seblu seblu commented Jul 1, 2023

When you set a config directory path (-c) on the command line, and only when, a file named logging.conf is read to set fine grained log levels. This allows to have per module/plugin log levels.

A simple logging.conf could be:

deluge:info
deluge.plugin.foo:debug

The file is parsed and the log levels are set in the deluge.log.tweak_logging_levels. This function set the appropriate logger to the desired level. Despite the log level is changed, log levels less than ERROR are still not logged.

The reason is that the log level check is done twice, in the logging.Logger class and in the logging.Handler class.

The fix is to not set the logging level in the Handler in deluge.log.setup_logger and let only the logging.Logger check the level.

When you set a config directory path (-c) on the command line, and only when,
a file named logging.conf is read to set fine grained log levels.
This allows to have per module/plugin log levels.

A simple logging.conf could be:
-<8 -------------------
deluge:info
deluge.plugin.foo:debug
-----------------------

The file is parsed and the log levels are set in the deluge.log.tweak_logging_levels.
This function set the appropriate logger to the desired level.
Despite the log level is changed, log levels less than ERROR are still not
logged.

The reason is that the log level check is done twice, in the logging.Logger class
and in the logging.Handler class.

The fix is to not set the logging level in the Handler in deluge.log.setup_logger
and let only the logging.Logger check the level.
@cas-- cas-- closed this in 1dbb18b Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant