Logs are critical to monitor the production environment. So we have some tools that, even though aren't Django exclusive, helps us interact with the native python logging module.


Filters can be used by Handlers and Loggers for more sophisticated filtering than is provided by levels. The base filter class only allows events which are below a certain point in the logger hierarchy.

Python Docs

Filters can remove some records from the output, but they also can include additional attributes to the LogRecord object, so that we can use with a formatter.


Adds the %(hostname)s entry to the log record. Its filter method always return True, so that no log record is removed from the output by this filter.

In order to use it, include a filter entry in your logging dictconfig.


    'filters': {
        'add_hostname': {
            '()': 'django_toolkit.logs.filters.AddHostName',
    'formatters': {
        'simple': {
            'format': '%(hostname)s %(levelname)s %(name)s %(message)s'
            # hostname is now available