Created
          December 12, 2012 02:00 
        
      - 
      
 - 
        
Save selwin/4264218 to your computer and use it in GitHub Desktop.  
Revisions
- 
        
selwin created this gist
Dec 12, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ from __future__ import with_statement import sys import django from django.core.management.base import BaseCommand from django.utils.log import getLogger class LoggingBaseCommand(BaseCommand): # A subclass of BaseCommand that logs errors to django.commands def __init__(self): super(LoggingBaseCommand, self).__init__() self._logger = getLogger('django.commands') def run_from_argv(self, argv): try: super(LoggingBaseCommand, self).run_from_argv(argv) except Exception, e: self._logger.error(e, exc_info=sys.exc_info(), extra={ 'status_code': 500, } ) raise