Google App Engine 오류 모니터링
GAE에서는 에러가 발생했을 때 이메일로 알려주는식의 방법으로 처리해야 하는데, Web Request Handler 클래스쪽에 handle_exception 메서드를 추가해주면 됩니다. 그리고는 다음과 같이 이메일을 발송하도록 처리하면 깔끔하게 처리할 수 있죠.
def global_handle_exception(response, exception):
# Log the error.
logging.exception(exception)
# Set a custom message.
response.write('An error occurred.')
mail.send_mail(sender="Alert <error@test.com>",
to= "test@test.com",
subject="GAE Error",
body="GAE error" + """:
""" + traceback.format_exc())
# If the exception is a HTTPException, use its error code.
# Otherwise use a generic 500 error code.
if isinstance(exception, webapp2.HTTPException):
response.set_status(exception.code)
else:
response.set_status(500)
(자바의 경우 http://lkubaski.wordpress.com/2012/02/15/error-handling-in-google-app-engine/ 링크를 참고하세요)
* 그런데 이 방법 말고도 Google Talk에 실시간으로 메시지를 전송하는 방법도 있군요.
http://lkubaski.wordpress.com/2012/02/16/real-time-error-monitoring-in-google-app-engine/
수고!