How to properly configure Python logging using dictConfig with JSON? or Best practices for setting up

14 Replies, 966 Views

Hey! I feel your pain—python logging dictconfig json can be a beast.

Here’s a quick snippet that might help:

```python
import logging.config
import json

with open('logging_config.json') as f:
config = json.load(f)
logging.config.dictConfig(config)
```

Make sure your JSON has at least a "handlers" and "formatters" section.

For less verbosity, try setting `"level": "INFO"` instead of DEBUG.

Also, check out the official Python docs—they’ve got solid examples.

Messages In This Thread



Users browsing this thread: 1 Guest(s)