2013年7月10日 星期三

Python Logging - Sentry

Sentry helps with exception logging and viewing for your Django project. It can handle multiple Django installs where the logs can be managed from a single place, or it can be used on a per-project basis. The latter is how it’s preconfigured in DJ Skeletor.
Besides logging the exceptions, Sentry can also catch normal logs you create with Python’s logging system. This is also preconfigured in DJ Skeletor.

Example

Enough talk, let’s see some action. First, we’ll create a virtual environment (you do use virtualenv, right? if not, you should) and install prerequisite packages:
    virtualenv --no-site-packages myenv
    cd myenv
    source bin/activate
    pip install django django-debug-toolbar south django-sentry
Next, we’ll clone the boilerplate project:
    git clone https://github.com/senko/dj-skeletor.git myproject
    cd myproject
Let’s activate the development environment and prepare the database:
    cd settings
    ln -s dev.py local.py
    cd ..
    python manage.py syncdb
    python manage.py migrate sentry
All done, let’s run it!
    python manage.py runserver
See? Piece of cake. With boring initial set-up out of our way, we can focus on building an awesome web site or app.
DJ Skeletor is open source and is available on GitHub. Feel free to use it or base your own boilerplate on it – if you do, please share your thoughts in the comments.
en → zh

沒有留言:

wibiya widget