{ "html": "
\n

Installation

\n

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

\n
pip install raven --upgrade\n
\n
\n
\n\n\n
\n

PasteDeploy Filter

\n

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

\n
[pipeline:main]\npipeline =\n    raven\n    tm\n    MyApp\n\n[filter:raven]\nuse = egg:raven#raven\ndsn = ___DSN___\ninclude_paths = my.package, my.other.package\nexclude_paths = my.package.crud\n
\n
\n

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.

\n

See the Pyramid PasteDeploy Configuration Documentation for more information.

\n
\n\n\n
\n

Logger setup

\n

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

\n
[loggers]\nkeys = root, sentry\n\n[handlers]\nkeys = console, sentry\n\n[formatters]\nkeys = generic\n\n[logger_root]\nlevel = INFO\nhandlers = console, sentry\n\n[logger_sentry]\nlevel = WARN\nhandlers = console\nqualname = sentry.errors\npropagate = 0\n\n[handler_console]\nclass = StreamHandler\nargs = (sys.stderr,)\nlevel = NOTSET\nformatter = generic\n\n[handler_sentry]\nclass = raven.handlers.logging.SentryHandler\nargs = ('___DSN___',)\nlevel = WARNING\nformatter = generic\n\n[formatter_generic]\nformat = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s\ndatefmt = %H:%M:%S\n
\n
\n
\n

Note

\n

You may want to setup other loggers as well. See the Pyramid Logging Documentation for more information.

\n
\n

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 = ().

\n
\n", "link": "https://docs.getsentry.com/clients/python/integrations/pyramid/", "id": "python-pyramid", "name": "Pyramid" }