Do You PHP はてブロ

Do You PHPはてなからはてブロに移動しました

SwatchでPHPのエラー監視

元記事は、Fatalエラーの検出時に指定アドレス宛にメールを飛ばす、といった内容です。


One big issue of the PHP error handling is that there’s no built-in way to catch fatal errors with an user-defined error handler. So I thought a little bit about it and maybe you have better approaches or solutions …

Swatchの設定は次のような感じです。

watchfor /(PHP.*error:.*?)$/i
mail addresses=root
threshold=on
threshold track_by=$1,type=limit,count=1,seconds=10

運用フェーズで使えますね。まあ、例に挙げられているようなParse errorが運用フェーズで発生してしまうこと自体ありえないと思いますが。。。:-P