Thursday, July 26, 2018

Re: How to see every activity in logs of Django 2.0.6?

OK, that's helpful.  Your loggers are set to handle error and above, right?  So Django's blocked from doing any logging below that, even with DEBUG = True

On Thursday, July 26, 2018 at 7:46:19 AM UTC-4, prateek gupta wrote:
I forgot to mentions, I am using logger also as below-
# send server errors to admin
ADMINS = (('admin', 'admin@example.com'),)
MANAGERS
= ADMINS

# Logging configuration for production
LOGGING = {
   
'version': 1,
   
'disable_existing_loggers': False,
   
'formatters': {
       
'verbose': {
           
'format': '%(asctime)s [%(levelname)s] %(filename)s:%(lineno)s %(funcName)s() : %(message)s'
        },
       
'simple': {
           
'format': '%(asctime)s [%(levelname)s] : %(message)s'
        },
   
},
   
'handlers': {
       
'file': {
           
'level': 'ERROR',
           
'class': 'logging.FileHandler',
           
'filename': 'error.log',
           
'formatter': 'verbose'
        },
       
'mail_admins': {
           
'level': 'ERROR',
           
'class': 'django.utils.log.AdminEmailHandler',
           
'formatter': 'simple'
        },
   
},
   
'loggers': {
       
'django': {
           
'handlers': ['file'],
           
'level': 'ERROR',
           
'propagate': True,
       
},
       
'django.request': {
           
'handlers': ['mail_admins'],
           
'level': 'ERROR',
           
'propagate': True,
       
},
   
},
}



On Thursday, July 26, 2018 at 4:47:18 PM UTC+5:30, Jason wrote:
ok, so you don't even have any logging configuration at all, no wonder you don't see anything.

I suggest you look in the docs for this:  https://docs.djangoproject.com/en/2.0/topics/logging/


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/76977bb7-8ca1-4460-8321-6aad3e002dc5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment