# How to alert admins if there is an error in a custom plugin?

**URL:** <https://meta.discourse.org/t/how-to-alert-admins-if-there-is-an-error-in-a-custom-plugin/70364>\
**Category:** Development\
**Created:** [2017 年 9 月 19 日午後 1:44 UTC](https://meta.discourse.org/t/how-to-alert-admins-if-there-is-an-error-in-a-custom-plugin/70364 "2017-09-19T13:44:51Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)\
**Post date:** [2017 年 9 月 20 日午前 8:42 UTC](https://meta.discourse.org/t/how-to-alert-admins-if-there-is-an-error-in-a-custom-plugin/70364/4 "2017-09-20T08:42:21Z")

</div>

To write to the logs, you should be able to do this from anywhere in ruby:

```plaintext
Rails.logger.info 'An info message'
Rails.logger.warn 'A warning message'
Rails.logger.error 'An error message'

```

I haven’t looked at those “alert admins” settings before, so not sure exactly how they work. I think they give admin users a warning on the site itself, rather than sending an email, but I could be wrong.

---

_[View the full topic](https://meta.discourse.org/t/how-to-alert-admins-if-there-is-an-error-in-a-custom-plugin/70364)._
