0

I have a Django project and some problems that some data save in DB automatically but can not find specific causes so, trying to trace all progress with DEBUG level logging and save the logs into a file temporarily. (I don't use any log in the source, don't want to install any library.)

But it doesn't seem to show DEBUG level and I want to get some advice simpler logging settings. Thanks for advance.

according to the document Django 1.3;

Django does not post messages using this name. Instead, it uses one of the loggers below.

seems like I have to set up for each progress and django (the parent logger) just sends INFO level message.

Here is my settings.py:

  LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'class': 'django.utils.log.AdminEmailHandler'
        },
        'file': {
            'level': 'DEBUG',
            "class": "logging.handlers.RotatingFileHandler",
            "filename": "logs/debug.log",
            "encoding": "utf-8", 
            "maxBytes": 10*1024*1024,
            "backupCount": 5
        }
    },
    'loggers': {
        # 'django': {
        #     'handlers': ['file'],
        #     'level': 'DEBUG'
        # },
        'django.request': {
            'handlers': ['mail_admins', 'file'],
            'level': 'DEBUG',
            'propagate': False,
        },
        'django.server': {
            'handlers': ['file'],
            'level': 'DEBUG',
            'propagate': False,
        },
        'django.template': {
            'handlers': ['file'],
            'level': 'DEBUG',
            'propagate': False,
        },
        'django.db.backends': {
            'handlers': ['file'],
            'level': 'DEBUG',
            'propagate': False,
        },
        'django.security.*': {
            'handlers': ['file'],
            'level': 'DEBUG',
            'propagate': False,
        }
    }
}
Doyoun
  • 89
  • 1
  • 11

0 Answers0