Answers.Body: <p><strong>Update:</strong></p>
  
  <p>Went to look into this and while it's true that Craft doesn't have any explicit events around error handling, Yii already does in the form of <a href="http://www.yiiframework.com/doc/api/1.1/CApplication#onException-detail" rel="nofollow">onException</a> and <a href="http://www.yiiframework.com/doc/api/1.1/CApplication#onError-detail" rel="nofollow">onError</a>.</p>
  
  <p>You can listen for them like so:</p>
  
  <pre><code>craft()-&gt;onException = array($this, 'myCustomExceptionMethodHandler');
  </code></pre>
  
  <p>and</p>
  
  <pre><code>craft()-&gt;onError = array($this, 'myCustomErrorMethodHandler');
  </code></pre>
  
  <hr>
  
  <p>Original answer:</p>
  
  <p>Craft currently doesn't have any events around error handling, but it's probably not a bad idea to do so for situations like this.</p>
  
  <p>I've added it to our list.</p>
  
  <p>In the meantime, the only workaround I can think of is pretty sketchy, but a plugin could monitor the <code>craft/storage/runtime/logs</code> folder for <code>[error]</code> entries and parse the text for the information it needs.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-14T20:50:54.623Z
Answers.LastActivityDate: 2014-11-13T01:33:57.410Z
Answers.LastEditDate: 2014-11-13T01:33:57.410Z
Answers.UserDisplayName: Brad Bell
Body: <p>Are their any best practices?</p>
  
  <p>Maybe some way to hook to craft native exception / log handler with a third party implantation so I could track my errors on services like <a href="https://getsentry.com/welcome/" rel="nofollow">Sentry</a> or <a href="https://rollbar.com" rel="nofollow">Rollbar</a>?</p>
  
Tags: <error-message>
Title: Log exception to a third party service like Sentry or Rollbar?
ThreadText: # Log exception to a third party service like Sentry or Rollbar?
  
  (Asked by: username_0 on 2014-10-14)
  
  Are their any best practices?
  
  Maybe some way to hook to craft native exception / log handler with a third party implantation so I could track my errors on services like [Sentry](https://getsentry.com/welcome/) or [Rollbar](https://rollbar.com)?
  
  **Tags:** error-message
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-10-14. Score: 2
  
  **Update:**
  
  Went to look into this and while it's true that Craft doesn't have any explicit events around error handling, Yii already does in the form of [onException](http://www.yiiframework.com/doc/api/1.1/CApplication#onException-detail) and [onError](http://www.yiiframework.com/doc/api/1.1/CApplication#onError-detail).
  
  You can listen for them like so:
  
  ```
  craft()->onException = array($this, 'myCustomExceptionMethodHandler');
  
  ```
  
  and
  
  ```
  craft()->onError = array($this, 'myCustomErrorMethodHandler');
  
  ```
  
  ---
  
  Original answer:
  
  Craft currently doesn't have any events around error handling, but it's probably not a bad idea to do so for situations like this.
  
  I've added it to our list.
  
  In the meantime, the only workaround I can think of is pretty sketchy, but a plugin could monitor the `craft/storage/runtime/logs` folder for `[error]` entries and parse the text for the information it needs.
  
  
  ---
  
  