Skip to content
This repository has been archived by the owner on Oct 21, 2018. It is now read-only.

Commit

Permalink
Trying to surpress annoying ioerror-request-data-read-error
Browse files Browse the repository at this point in the history
  • Loading branch information
David Burke committed Jun 13, 2013
1 parent 3986c7b commit 75e09ac
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
Empty file added common/__init__.py
Empty file.
10 changes: 10 additions & 0 deletions common/logging.py
@@ -0,0 +1,10 @@
import sys, traceback

class SuppressUnreadablePost(object):
def filter(self, record):
_, exception, tb = sys.exc_info()
if isinstance(exception, IOError):
for _, _, function, _ in traceback.extract_tb(tb):
if function == '_get_raw_post_data':
return False
return True
13 changes: 6 additions & 7 deletions django_sis/settings.py
Expand Up @@ -267,20 +267,19 @@ def skip_unreadable_post(record):
},
},
'filters': {
'skip_unreadable_posts': {
'()': 'django.utils.log.CallbackFilter',
'callback': skip_unreadable_post,
}
},
'supress_unreadable_post': {
'()': 'common.logging.SuppressUnreadablePost',
}
},
'handlers': {
'sentry': {
'level': 'WARNING',
'filters': ['skip_unreadable_posts'],
'filters': ['supress_unreadable_post'],
'class': 'raven.contrib.django.handlers.SentryHandler',
},
'console': {
'level': 'DEBUG',
'filters': ['skip_unreadable_posts'],
'filters': ['supress_unreadable_post'],
'class': 'logging.StreamHandler',
'formatter': 'verbose'
},
Expand Down

0 comments on commit 75e09ac

Please sign in to comment.