Skip to content

Instantly share code, notes, and snippets.

@rob-b
Created October 17, 2012 15:51
Show Gist options
  • Select an option

  • Save rob-b/3906313 to your computer and use it in GitHub Desktop.

Select an option

Save rob-b/3906313 to your computer and use it in GitHub Desktop.
Change default project logging
from .settings import *
LOGGING['formatters']['logsna'] = {'()': 'logsna.Formatter'}
db_handler = {'level': 'INFO',
'class': 'logging.handlers.RotatingFileHandler',
'filename': here('logs', 'db.log'),
'maxBytes': 4194304,
'formatter': 'logsna',
'backupCount': 1}
auth_handler = dict(db_handler, filename=here('logs', 'auth.log'))
LOGGING['handlers']['db-file'] = db_handler
LOGGING['handlers']['auth-file'] = auth_handler
LOGGING['loggers']['django.db']['handlers'] = ['db-file']
LOGGING['loggers']['myapp.module'] = {'handlers': ['auth-file']}
for formatter in LOGGING['formatters']:
LOGGING['formatters'][formatter] = {'()': 'logsna.Formatter'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment