Skip to content

Commit

Permalink
Use commonware.log to override logging.Logger.
Browse files Browse the repository at this point in the history
  • Loading branch information
James Socol committed Apr 23, 2010
1 parent 9a2e5be commit 470e893
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion log_settings.py
Expand Up @@ -3,6 +3,10 @@

from django.conf import settings

import commonware.log

# Override logging.Logger to add REMOTE_ADDR to our log formats.
logging.setLoggerClass(commonware.log.Logger)

# Loggers created under the "z" namespace, e.g. "z.caching", will inherit the
# configuration from the base z logger.
Expand All @@ -18,7 +22,8 @@
formatter = logging.Formatter(fmt, datefmt='%H:%M:%S')
else:
fmt = '%s: %s' % (settings.SYSLOG_TAG,
'%(name)s:%(levelname)s %(message)s :%(pathname)s:%(lineno)s')
'[%(REMOTE_ADDR)s] %(name)s:%(levelname)s %(message)s '
':%(pathname)s:%(lineno)s')
fmt = getattr(settings, 'SYSLOG_FORMAT', fmt)
SysLogger = logging.handlers.SysLogHandler
handler = SysLogger(facility=SysLogger.LOG_LOCAL7)
Expand Down
1 change: 1 addition & 0 deletions requirements-prod.txt
Expand Up @@ -16,3 +16,4 @@ GitPython==0.1.7
-e git://github.com/jbalogh/schematic.git#egg=schematic
-e git://github.com/clouserw/tower.git#egg=tower
-e git://github.com/jbalogh/django-queryset-transform.git#egg=django-queryset-transform
-e git://github.com/jsocol/commonware.git#egg=commonware
1 change: 1 addition & 0 deletions settings.py
Expand Up @@ -162,6 +162,7 @@ def JINJA_CONFIG():


MIDDLEWARE_CLASSES = (
'commonware.log.ThreadRequestMiddleware',
# AMO URL middleware comes first so everyone else sees nice URLs.
'amo.middleware.LocaleAndAppURLMiddleware',

Expand Down

0 comments on commit 470e893

Please sign in to comment.