Skip to content
Back to top
View this page

# Using with Django

Django has a default logging configuration that executes when the application initializes. This configuration is defined in the `LOGGING` variable in the `settings.py` file. By default, Django will configure a set of streaming loggers from the standard library logging module.

To use picologging with Django, you need to change some settings.

1. Set `LOGGING_CONFIG` to `None` in `settings.py`. This will prevent Django from configuring the default logging system.

2. Change the handler classes from `logging.xxx` to `picologging.xxx`, e.g. `logging.StreamHandler` to `picologging.StreamHandler`.

3. Call `picologging.config.dictConfig(LOGGING)` in `settings.py` to configure picologging.

4. Change your imports where logging is used to ``import picologging as logging`.

Here is a complete example of `settings.py`

Then in a view to use those loggers: