django-timelog

Performance logging middlware and analysis tools for Django
Download

django-timelog Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Publisher Name:
  • Gareth Rushgrove
  • Publisher web site:
  • http://github.com/garethr/

django-timelog Tags


django-timelog Description

Performance logging middlware and analysis tools for Django django-timelog is a Django app that was heavily influenced by the Rails Request log analyzer.Installationpip install django-timelogOnce installed you need to do a little configuration to get things working. First add the middleware to your MIDDLEWARE_CLASSES in your settings file.MIDDLEWARE_CLASSES = ( 'timelog.middleware.TimeLogMiddleware',Next add timelog to your INSTALLED_APPS list. This is purely for the management command discovery.INSTALLED_APPS = ( 'timelog',Then configure the logger you want to use. This really depends on what you want to do, the django 1.3 logging setup is pretty powerful. Here’s how I’ve got logging setup as an example:TIMELOG_LOG = '/path/to/logs/timelog.log'LOGGING = { 'version': 1, 'formatters': { 'plain': { 'format': '%(asctime)s %(message)s'}, }, 'handlers': { 'timelog': { 'level': 'DEBUG', 'class': 'logging.handlers.RotatingFileHandler', 'filename': TIMELOG_LOG, 'maxBytes': 1024 * 1024 * 5, # 5 MB 'backupCount': 5, 'formatter': 'plain', }, }, 'loggers': { 'timelog.middleware': { 'handlers': , 'level': 'DEBUG', 'propogate': False, } }}Lastly, if you have particular URIs you wish to ignore you can define them using basic regular expressions in the TIMELOG_IGNORE_URIS list in settings.py:TIMELOG_IGNORE_URIS = ( '^/admin/', # Ignores all URIs beginning with '/admin/' '^/other_page/$', # Ignores the URI '/other_page/' only, but not '/other_page/more/'. '.jpg$', # Ignores all URIs ending in .jpg) Requirements: · Python · Django


django-timelog Related Software