Skip to content

Python dictConfig example config is inaccurate #17

Description

@FSund

This is not the correct way to configure the root logger. This configures the logger named "root", which is a child of the actual root logger. The effect is that logger = logging.getLogger("my_logger") does not use the configuration from the JSON (since "my_logger" is not a child of "root", but of the actual root logger, which has not been configured).

"loggers": {
"root": {
"level": "DEBUG",
"handlers": [
"stderr",
"file"
]
}
}

The root logger uses a separate root key (source), so the correct JSON would be

  "loggers": {},
  "root": {
    "level": "DEBUG",
    "handlers": [
      "stderr",
      "file"
    ]
  }

(the empty "loggers" key can probably be skipped).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions