If you haven’t already, start by downloading Raven. The easiest way is with pip:

pip install raven --upgrade

PasteDeploy Filter

A filter factory for PasteDeploy exists to allow easily inserting Raven into a WSGI pipeline:

pipeline =

use = egg:raven#raven
dsn = ___DSN___
include_paths = my.package, my.other.package
exclude_paths = my.package.crud

In the [filter:raven] section, you must specify the entry-point for raven with the use = key. All other raven client parameters can be included in this section as well.

See the Pyramid PasteDeploy Configuration Documentation for more information.

Logger setup

Add the following lines to your project’s .ini file to setup SentryHandler:

keys = root, sentry

keys = console, sentry

keys = generic

level = INFO
handlers = console, sentry

level = WARN
handlers = console
qualname = sentry.errors
propagate = 0

class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

class = raven.handlers.logging.SentryHandler
args = ('___DSN___',)
level = WARNING
formatter = generic

format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S

Instead of defining the DSN in the .ini file you can also use the environment variable SENTRY_DSN which overwrites the setting in this file. Because of a syntax check you cannot remove the args setting completely, as workaround you can define an empty list of arguments args = ().