Help me understand this logging config

Roy Smith roy at panix.com
Mon Aug 29 19:53:35 CEST 2011


I'm using django 1.3 and python 2.6.

My logging config is:


LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'verbose': {
            'format': '%(asctime)s: %(name)s %(levelname)s %
(funcName)s %(message)s'
            }
        },
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'class': 'django.utils.log.AdminEmailHandler'
        },
        'console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
            'formatter': 'verbose',
	},
    },
    'loggers': {
        'django.request': {'handlers': ['mail_admins'],
                           'level': 'ERROR',
                           'propagate': True,
                           },
        'djfront': {'handlers': ['console'],
                    'propagate': True,
                    },
	'djfront.view': {'level': 'INFO'},
        'djfront.auth': {'level': 'INFO'},
        'djfront.auth.user': {'level': 'INFO'},
	'djfront.api': {'level': 'WARN'},
        }
    }

In my code, I do:

logger = logging.getLogger('djfront.auth.facebook')

Since I haven't configured a 'djfront.auth.facebook' logger, it should
inherit the 'djfront.auth' config, which means the logging level
should be set to INFO.  But, when I do:

    logger.debug('redirecting to "%s"' % url)

it emits a message:

2011-08-29 13:31:03,321: djfront.auth.facebook DEBUG oauth_init
redirecting to [...]

I'm confused.  Why is the debug level message not getting filtered
out?




More information about the Python-list mailing list