error_log级别分为debug、info、notice、warn、error、crit,默认为error,crit记录的日志最少,而debug记录的日志最多,如果你的nginx遇到问题,比如502频繁出现,但是看默认的error_log并没有看到有意义的信息,那么久可以调一下错误日志的级别,调成error级别时,错误日志记录的内容会更加丰富,该级别在日志名后边定义格式如下:
[root@daixuan conf]# vim nginx.conf
user nobody nobody;
worker_processes 2;
error_log /usr/local/nginx/logs/nginx_error.log crit;
pid /usr/local/nginx/logs/nginx.pid;
worker_rlimit_nofile 51200;
每个日志级别包括更高级别。例如,如果您将日志级别设置为warn
,则Nginx还将记录error
,crit
,alert
和emerg
消息。未指定log_level
参数时,默认为error
。
debug
-调试消息。info
-信息性消息。notice
-公告。warn
-警告。error
-处理请求时出错。crit
-关键问题。需要立即采取行动。alert
-警报。必须立即采取行动。emerg
- 紧急情况。系统处于无法使用的状态。