Maybe you can use this snippet, this will log exceptions in apache's log:
utils.py
:
def log_traceback(exception, args):
import sys, traceback, logging
exceptionType, exceptionValue, exceptionTraceback = sys.exc_info()
logging.debug(exception)
logging.debug(args)
for tb in traceback.format_exception(exceptionType, exceptionValue, exceptionTraceback):
logging.debug(tb)
site_logging.py
:
import logging
import sys
logger = logging.getLogger('')
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stderr)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(levelname)-8s %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)
Put it in your settings.py
:
import site_logging
And in your code:
from where.is.your.utils import log_traceback
try:
`do something`
except Exception, args
log_traceback(Exception, args)