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

Extended docs with logging customisation at runtime #3968

Merged
merged 5 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

## Documentation changes

Extended documentation with an example of logging customisation at runtime

## Community contributions

# Release 0.19.6
Expand Down
15 changes: 15 additions & 0 deletions docs/source/logging/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,21 @@
If the `KEDRO_LOGGING_CONFIG` environment variable is not set, Kedro will use the [default logging configuration](https://github.com/kedro-org/kedro/blob/main/kedro/framework/project/default_logging.yml).
```

### Change the verbosity of specific parts of Kedro

You can also customise logging at runtime and redefine the logging configuration provided in the `logging.yml` when using jupyter notebook.

Check warning on line 47 in docs/source/logging/index.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/source/logging/index.md#L47

[Kedro.Spellings] Did you really mean 'jupyter'?
Raw output
{"message": "[Kedro.Spellings] Did you really mean 'jupyter'?", "location": {"path": "docs/source/logging/index.md", "range": {"start": {"line": 47, "column": 123}}}, "severity": "WARNING"}
The example below demonstrates how you can change the logging level from default `INFO` to `WARNING` for the `kedro.io.data_catalog` component logger specifically, the logging for the rest of the components will remain unchanged.
The same can be done for higher/lower-level components without affecting the top-level.

Add the following to a cell in your notebook:

```ipython
import logging


logging.getLogger("kedro.io.data_catalog").setLevel(logging.WARNING)
```

## Custom `CONF_SOURCE` with logging

When you customise the [`CONF_SOURCE`](../configuration/configuration_basics.md#how-to-change-the-configuration-source-folder-at-runtime) setting in your Kedro project, it determines where Kedro looks for configuration files, including the logging configuration file. However, changing `CONF_SOURCE` does not automatically update the path to `logging.yml`. To use a custom location or filename for the logging configuration, you must explicitly set the `KEDRO_LOGGING_CONFIG` environment variable.
Expand Down