Use module loggers rather than the root logger. Exceptions caused by bad clients shouldn't cause ERROR level logging. Fix sql logging to use 'repr' rather than 'str'

This commit is contained in:
Mark Haines 2014-11-20 17:10:37 +00:00
parent 32090aee16
commit dfdda2c871
8 changed files with 17 additions and 10 deletions

View file

@ -1,6 +1,8 @@
import threading
import logging
logger = logging.getLogger(__name__)
class LoggingContext(object):
"""Additional context for log formatting. Contexts are scoped within a
@ -53,7 +55,7 @@ class LoggingContext(object):
None to avoid suppressing any exeptions that were thrown.
"""
if self.thread_local.current_context is not self:
logging.error(
logger.error(
"Current logging context %s is not the expected context %s",
self.thread_local.current_context,
self