user7804233
user7804233

Reputation:

How to see Django logging in production

I'm deploying a Django project in production with, obviously, DEBUG=False. How can I see all Django logs like in development environment?

I've configured a logger but I'm only able to see custom logs in a file. Where are the default ones?

Upvotes: 6

Views: 13555

Answers (1)

hoefling
hoefling

Reputation: 66251

You have to configure the logger for the django module for it to route records to file. Example:

LOGGING = {                                                                                                                 
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'logfile': {
            'class': 'logging.FileHandler',
            'filename': 'server.log',
        },
    },
    'loggers': {
        'django': {
            'handlers': ['logfile'],
        },
    },
}

Consult list of django loggers to see what other loggers Django offers.

Upvotes: 9

Related Questions