bobobobo
bobobobo

Reputation: 67244

GAE email me errors

Can GAE be configured to bust me an email when there's an error?

Upvotes: 3

Views: 346

Answers (2)

Fishbone
Fishbone

Reputation: 41

Here's an example of using GAE to send an email. You could build on this example to catch exceptions and send an email to yourself....

http://www.fishbonecloud.com/2010/11/automated-email-using-google-app-engine.html

Upvotes: 0

Alex Martelli
Alex Martelli

Reputation: 881675

I think the best you can do is to have in your main function some code like...:

try:
  ...normal body of your main goes here...
except:
  from google.appengine.api import mail
  import sys

  mail.send_mail(sender="Your GAE App <[email protected]>",
              to="You <[email protected]>",
              subject="GAE App error",
              body="""
Your App Engine app raised an exception:
  %s
""" % sys.exc_info()[:2])

(of course, you can do better formatting on the exception information, etc, etc).

Upvotes: 4

Related Questions