{ "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

WSGI Middleware

\n

A Pylons-specific middleware exists to enable easy configuration from settings:

\n
from raven.contrib.pylons import Sentry\n\napplication = Sentry(application, config)\n
\n
\n

Configuration is handled via the sentry namespace:

\n
[sentry]\ndsn=___DSN___\ninclude_paths=my.package,my.other.package,\nexclude_paths=my.package.crud\n
\n
\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 = ('SENTRY_DSN',)\nlevel = NOTSET\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.

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