Skip to content

Logging with Sentry

zoni edited this page Oct 9, 2012 · 2 revisions

According to the official website...

Sentry is an event logging platform primarily focused on capturing and aggregating exceptions.

It was originally conceived at DISQUS in early 2010 to solve exception logging within a Django application. Since then it has grown to support many popular languages and platforms, including Python, PHP, Java, Ruby, Node.js, and even JavaScript.

Come again? Just what is Sentry, exactly?

The official documentation explains it better

Sentry is a realtime event logging and aggregation platform. At its core it specializes in monitoring errors and extracting all the information needed to do a proper post-mortem without any of the hassle of the standard user feedback loop.

If that sounds like something you'd want to gift your precious Err instance with, then do keep on reading :)

Setting up Sentry itself

Installing and configuring sentry is beyond the scope of this document. However, you two options. You can either get a hosted account, or grab the code and run your own server instead.

Configuring Err to use Sentry

Once you have an instance of Sentry available, you'll probably want to create a team specifically for Err first.

When you have, you should be able to access a page called "Client configuration". There, you will be presented with a so-called DNS value, which has the following format:

http://00000000000000000000000000000000:[email protected]/0

To setup Err with Sentry:

  • Open up your bot's config.py
  • Set BOT_LOG_SENTRY to True and fill in SENTRY_DSN with the DNS value obtained previously
  • Optionally adjust SENTRY_LOGLEVEL to the desired level
  • Restart Err

You should now see Exceptions and log messages show up in your Sentry stream.

Clone this wiki locally