In my django project I have following LOGGING config:
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'verbose': {
'format': '%(name)s %(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',
},
'sentry': {
'level': 'DEBUG',
'class': 'sentry.client.handlers.SentryHandler',
'formatter': 'verbose'
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose'
}
},
'loggers': {
'django.db.backends': {
'handlers': ['console'],
'level': 'INFO',
'propagate': False,
},
'': {
'level': 'ERROR',
'handlers': ['console'],
},
},
}
When running manage.py migrate
I still have a lot of debug stuff in console, e.g:
DEBUG south 2011-08-08 11:22:23,847 generic 19539 140735078710464 south execute "..."
I'm expecting only error messages in console as I set root logger level to ERROR. What am I doing wrong?
UPDATE
Looks like problem is in south.logger
module:
import sys
import logging
from django.conf import settings
# Create a dummy handler to use for now.
class NullHandler(logging.Handler):
def emit(self, record):
pass
_logger = logging.getLogger("south")
_logger.addHandler(NullHandler())
_logger.setLevel(logging.DEBUG)
After removing _logger.setLevel(logging.DEBUG)
logging works as expected.
Can someone explain me such weird behavior?
The South developers shouldn't really be setting its top level logger level to DEBUG. In fact if they don't set it at all, it would inherit the root logger's level, which is normally defined by the application developer (which I guess is you, in this case).
I would suggest you report this as a bug on the relevant South forum.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With