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

[DOCS] Update incorrect details for log_granular_levels section of doc/ref/configuration/logging/index.rst #66884

Open
austinbrowder opened this issue Sep 12, 2024 · 1 comment
Labels
Documentation Relates to Salt documentation needs-triage

Comments

@austinbrowder
Copy link

Description
The instructions for log_granular_levels show how to set a custom module to the log level all but in practice this does not work. Not sure if this is due to all not being a native log level within Pythons logging module.

Additionally, the following sentence needs updating.

You can determine what log call name to use here by adding %(module)s to the log format.

In practice Ive found that %(module)s only prints the short name of the module (i.e. custom_module).
However, %(name)s prints the fully qualified name of the module (i.e. salt.loaded.ext.module.custom_module).

Suggested Fix

Updated doc example:

log_granular_levels

Default: {}

This can be used to control logging levels more specifically, based on log call name. The example sets
the main salt library at the warning level, sets salt.modules to log
at the info level, and sets custom modules to the debug level:

  log_granular_levels:
    'salt': 'warning'
    'salt.modules': 'info'
    'salt.loader.saltmaster.ext.module.custom_module': 'debug'
    'salt.loaded.ext.module.custom_module': 'debug'
    'salt.loaded.ext.states.custom_module': 'debug'

You can determine what log call name to use here by adding %(name)s to the
log format. Typically, it is the path of the file which generates the log
without the trailing .py and with path separators replaced with .

Note: For these granular log levels to be reflected in the logs, the log_level_logfile and/or log_level
configurations must be set to at least the lowest level specified in the granular settings. For example, if
you set a module to log at the debug level in log_granular_levels, the log_level_logfile or log_level
must be set to debug for those debug logs to be written. Otherwise, the more restrictive general log level
will take precedence.

Type of documentation

  • Salt documentation

Location or format of documentation
doc/ref/configuration/logging/index.rst

@austinbrowder austinbrowder added Documentation Relates to Salt documentation needs-triage labels Sep 12, 2024
Copy link

welcome bot commented Sep 12, 2024

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at [email protected]. We’re glad you’ve joined our community and look forward to doing awesome things with you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Relates to Salt documentation needs-triage
Projects
None yet
Development

No branches or pull requests

1 participant