Skip to content

Commit

Permalink
docs(logging): remove example about capturing from the root logger (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rexledesma committed Mar 23, 2022
1 parent 0c7f490 commit bcc1fd7
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 27 deletions.
12 changes: 1 addition & 11 deletions docs/content/concepts/logging/python-logging.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ With the default behavior, because this code uses a custom python logger (instea

This can be accomplished by setting the `managed_python_loggers` key in your dagster.yaml file to a list of python logger names that you would like to capture:

```yaml file=/concepts/logging/python_logging_managed_loggers_config2.yaml
```yaml file=/concepts/logging/python_logging_managed_loggers_config.yaml
python_logs:
managed_python_loggers:
- my_logger
Expand Down Expand Up @@ -81,16 +81,6 @@ def ambitious_op():

Note: The logging module retains global state, meaning the logger returned by this function will be identical if this function is called multiple times with the same arguments in the same process. This means that there may be unpredictable or unituitive results if you set the level of the returned python logger to different values in different parts of your code.

### Example: Capturing logs from all python loggers

If you would like to capture logs from ALL python loggers, you can simply include `root` in your list, as python loggers are arranged in a hierarchy, with `root` as the parent of all other loggers:

```yaml file=/concepts/logging/python_logging_managed_loggers_config.yaml
python_logs:
managed_python_loggers:
- root
```

## Configuring A Python Log Level <Experimental />

If you want to set a global log level for your Dagster instance, you can do this by setting the `python_log_level` in your dagster.yaml file. This will set the log level of all loggers managed by Dagster. By default, this will just be the `context.log` logger. If there are custom python loggers that you wish to capture, see [Capturing Python Logs](#capturing-python-logs).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
python_logs:
managed_python_loggers:
- root
- my_logger
- my_other_logger

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,6 @@ def test_valid_managed_loggers_instance_yaml():
config_filename="python_logging_managed_loggers_config.yaml",
)
instance = DagsterInstance.from_ref(ref)
assert instance.managed_python_loggers == ["root"]


def test_valid_managed_loggers_instance_yaml_2():
ref = InstanceRef.from_dir(
base_dir=file_relative_path(
__file__, "../../../docs_snippets/concepts/logging"
),
config_filename="python_logging_managed_loggers_config2.yaml",
)
instance = DagsterInstance.from_ref(ref)
assert instance.managed_python_loggers == ["my_logger", "my_other_logger"]


Expand Down

1 comment on commit bcc1fd7

@vercel
Copy link

@vercel vercel bot commented on bcc1fd7 Mar 23, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.