documentation on logging, with a few items removed for simplicity. I
have found that the logger django.request is not running even though I
am trying to log an error from within a view. If I add '' logger
(thanks to some other posts found here), that logger will run a
handler. What am I missing with the default django.request logger?
#settings
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %
(process)d %(thread)d %(message)s'
},
'simple': {
'format': '%(levelname)s %(message)s'
},
},
'handlers': {
'null': {
'level':'DEBUG',
'class':'django.utils.log.NullHandler',
},
'console':{
'level':'DEBUG',
'class':'logging.StreamHandler',
'formatter': 'simple'
},
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler',
},
'log_it':{
'level':'ERROR',
'class' : 'logging.handlers.RotatingFileHandler',
'filename' : os.path.join(SITEROOT, 'MYLOGGING.log'),
'formatter' : 'verbose',
'backupCount' :'5',
'maxBytes' : '5000000'
}
},
'loggers': {
'django': {
'handlers':['null'],
'propagate': True,
'level':'INFO',
},
'django.request': {
'handlers': ['log_it'],
'level': 'ERROR',
'propagate': False,
},
'':{
'handlers': ['log_it'],
'level': 'ERROR',
'propagate': False,
}
}
}
and the view...
import logging
logger = logging.getLogger(__name__)
def FAQ(request):
logger.error('test logging error')
return render_to_response("FAQ.html",
context_instance=RequestContext(request))
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment