nginxのエラーログ出力方法と確認
設定ファイルの確認
デフォルトでは下記のように記載されている。
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
上記の場合、ログファイルは /var/log/nginx/error.logに吐き出され
書き込まれるエラーレベルはwarn以上となる。
エラーログのレベル(上に行くほど、重要度大)
-
emerg: Emergency situations where the system is in an unusable state.
-
alert: Severe situation where action is needed promptly.
-
crit: Important problems that need to be addressed.
-
error: An Error has occurred. Something was unsuccessful.
-
warn: Something out of the ordinary happened, but not a cause for concern.
-
notice: Something normal, but worth noting has happened.
-
info: An informational message that might be nice to know.
-
debug: Debugging information that can be useful to pinpoint where a problem is occurring.
エラーログ[和訳]
- emerg: システムが使用できない状態にある緊急事態。
- alert: 早急に対応すべき事態。
- crit: 対処すべき重要な問題。
- error: 何かが失敗している。
- warn: 正常じゃないことが起こっているけど、そんな重要じゃないよ。
- notice: いたって普通だけど、注意すべきことが起こっている。
- info: 知っておくといいかもしれない情報。
- debug: 問題が起こっている場所を知るのに有効な情報。
エラーログのレベルの動作
下位のレベルを指定すると、上位のレベルも出力されます。
例えば)
errorを指定すると、その上位のcrit, alert, emergレベルのログも吐き出されます。
debugログの注意
標準ではdebugログは出力しません。
コンパイルオプション
--with-debug