Error/Exception collector and reporter
Project description
zilch
zilch is a small library for recording and viewing exceptions from Python. This library is inspired by (and uses several of the same functions from) David Cramer’s Sentry, but aims to implement just the core features in a smaller code/feature footprint.
Requirements
Optional
ZeroMQ (For network based reporting)
SQLAlchemy (For the database backend recorder)
Pyramid and WebHelpers (For the recorder web UI)
Basic Usage
Reporting an Exception
In the application that wants to report errors, import zilch and configure the reporter to record directly to the database:
from zilch.store import SQLAlchemyStore import zilch.client zilch.client.store = SQLAlchemyStore('sqlite:///exceptions.db')
Then to report an exception:
from zilch.client import capture_exception try: # do something that explodes except Exception, e: capture_exception()
The error will then be recorded in the database for later viewing.
Advanced Usage
In larger cluster scenarios, or where latency is important, the reporting of the exception can be handed off to ZeroMQ to be recorded to a central recorder over the network. Both the client and recording machine must have ZeroMQ installed.
To setup the client for recording:
import zilch.client zilch.client.recorder_host = "tcp://localhost:5555"
Then to report an exception:
from zilch.client import capture_exception try: # do something that explodes except Exception, e: capture_exception()
The exception will then be sent to the recorder_host listening at the recorder_host specified.
Recording Exceptions Centrally
The recorder uses ZeroMQ to record exception reports delivered over the network. To run the recorder host, on the machine recording them run:
>> zilch-recorder tcp://localhost:5555 sqlite:///exceptions.db
Without a Recorder running, ZeroMQ will hold onto the messages until it is available. After which point, it will begin to block (In the future, an option will be added to configure the disk offloading of messages).
The recorder will create the tables necessary on its initial launch.
Viewing Recorded Exceptions
zilch comes with a Pyramid web application to view the database of recorded exceptions. Once you have installed Pyramid and WebHelpers, you can run the web interface by typing:
>> zilch-web sqlite:///exceptions.db
Additional web configuration parameters are available to designate the host/port that the web application should bind to (viewable by running zilch-web with the -h option).
License
zilch is offered under the MIT license.
Support
zilch is considered feature-complete as the project owner (Ben Bangert) has no additional functionality or development beyond bug fixes planned. Bugs can be filed on github, should be accompanied by a test case to retain current code coverage, and should be in a Pull request when ready to be accepted into the zilch code-base.
For a more full-featured error collector, Sentry now has a stand-alone client that no longer requires Django called Raven. zilch was created before Raven was available, and the author now uses Raven rather than zilch most of the time.
zilch
0.1.3 (01/13/2012)
Features
Applied pull request from Marius Gedminas to add prefix option support to the error view webapp.
0.1.2 (08/07/2011)
Bug Fixes
Cleanup session at end of request.
0.1.1 (07/25/2011)
Bug Fixes
Fix bug with webob imports in client.py
0.1 (07/25/2011)
Features
Exception reporting via SQLAlchemy and/or ZeroMQ
Recording Store can be pluggable
WSGI Middleware to capture exceptions with WSGI/CGI environment data
Web User Interface for the recorder to view collected exceptions
Event tagging to record additional information per exception such as the Hostname, Application, etc.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.