11
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PHPで例外発生時のメッセージを記録する

Posted at

なんか例外発生時のメッセージを記録しておきたいんだけど、こんな感じでいいのかな。エラーログと混ぜるなって話もあるけど

<?php
try {
    throw new Exception("Some error message");
} catch(Exception $e) {

    // /var/log/php/error.log とかphp.ini で設定した所に記録される
    error_log($e, 3);

	// 混ぜたくないなら
    error_log($e, 3, "/var/log/php/exception.log");
}
11
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?