Thursday, June 2, 2011

Re: Disable debug logging for django.db.backends?

Alternatively, configure your logging handlers to send the db logging somewhere else (ie another file), and not to pass it on.

So in settings.py have:

LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'file_logging': {
'level' : 'DEBUG',
'class' : 'logging.handlers.RotatingFileHandler',
'backupCount' : 5,
'maxBytes': 5000000,
'filename': 'django.log'
},
'db_logging': {
'level' : 'DEBUG',
'class' : 'logging.handlers.RotatingFileHandler',
'backupCount' : 5,
'maxBytes': 5000000,
'filename': 'django-db.log'
},
},

'loggers': {
'django' : {
'handlers': ['file_logging'],
'level' : 'DEBUG',
'propagate' : False,
},
'django.db' : {
'handlers' : ['db_logging'],
'level' : 'DEBUG',
'propagate': False,
},
}

Which should send your db logs just to the django-db.log file.

HTH,

Malcolm

On 30 May 2011, at 18:11, Nathan Duthoit wrote:

> It's more of a hack than a clean solution but it works. Add the
> following to your settings file:
>
> import logging
> logging.getLogger('django.db.backends').setLevel(logging.ERROR)
>
> On May 24, 12:32 am, diafygi <diaf...@gmail.com> wrote:
>> Howdy all,
>>
>> I have DEBUG=True in my settings.py, and I have several logging
>> entries in my project (Django 1.3)
>>
>> However, when I am testing, there are tons of django.db.backends debug
>> entries that appear, and my logs gets lost in the shuffle.
>>
>> Is there a way to disable django.db.backends in my settings.py? What
>> is an example?
>>
>> Thanks,
>> Daniel
>
> --
> 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.
>

--
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