0

I'm using logging in my Django project.

  • If I set handlers to file, I can find logs in the file.
  • If I set handlers to console, there is nothing happened.

Here is the setting

LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'handlers': {
        'console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
        },
        'file': {
            'level': 'DEBUG',
            'class': 'logging.FileHandler',
            'filename': 'path/debug.log',
        },
    },
    'loggers': {
        'main': {
            'handlers': ['console'],
            'level': 'DEBUG',
        },
    },
},

where is the problem?

UPDATE

main is in my project since I can see the log in log file when set file handlers

And add one more information, I'm not debugging locally, I just deploy my django server with debug=true and access it through public ip

Yuwen Yan
  • 4,777
  • 10
  • 33
  • 63

0 Answers0