Powered by Squarespace
Main | Chill The F*!% out over the Google/Verizon Proposal »
Tuesday
Jul052011

Snippet: Syslog Config for Django 1.3

After a bunch of searching and dealing with odd errors, I finally figured out how to get syslog to play nice with Django 1.3’s new logging config. I’m posting it here for my own future reference and for anybody else who might find it useful.

from logging.handlers import SysLogHandler
LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'formatters': {
        'syslog': {
            'format': 'songtrust: %(levelname)s %(module)s "%(message)s"'
        },
    },
    'handlers': {
        'syslog':{ 
            'level':'DEBUG', 
            'class': 'logging.handlers.SysLogHandler', 
            'formatter': 'syslog', 
            'facility': SysLogHandler.LOG_LOCAL2,
            'address': '/dev/log',
        },
    },
    'loggers': {
        'django.request': {
            'handlers': ['syslog'],
            'level': 'DEBUG',
            'propagate': False,
        },
    },
}

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>