nginx学习随笔--error_log

nginx学习随笔–error_log

  • 英文原文:

Syntax: error_log file [level];
Default: error_log logs/error.log
error; Context: main, http, mail, stream, server, location

Configures logging. Several logs can be specified on the same level (1.5.2). If on the main configuration level writing a log to a file is not explicitly defined, the default file will be used.

The first parameter defines a file that will store the log. The special value stderr selects the standard error file. Logging to syslog can be configured by specifying the “syslog:” prefix. Logging to a cyclic memory buffer can be configured by specifying the “memory:” prefix and buffer size, and is generally used for debugging (1.7.11).

The second parameter determines the level of logging, and can be one of the following: debug, info, notice, warn, error, crit, alert, or emerg. Log levels above are listed in the order of increasing severity. Setting a certain log level will cause all messages of the specified and more severe log levels to be logged. For example, the default level error will cause error, crit, alert, and emerg messages to be logged. If this parameter is omitted then error is used.

For debug logging to work, nginx needs to be built with –with-debug, see “A debugging log”.
The directive can be specified on the stream level starting from version 1.7.11, and on the mail level starting from version 1.9.0.

  • 中文翻译:

配置记录日志。在同一级上可以配置多个日志。如果在main级上没有指定在哪里记录日志,就会启用默认文件。
第一个参数定义了存储日志的文件。一个特殊的值stderr
选择标准的错误文件。支持通过配置“syslog:”前缀来将日志记录到syslog上。支持通过配置“memory:”前缀和缓冲区大小size来将日志记录到循环内存缓冲区(一般用作调试)。
第二个参数决定日志的级别。,可以是下面的一个:debug,info,notice,warn,error,crit,alert或者emerg。上面的日志级别是按照严重程度的顺序排列的。设置一个确定的日志级别,指定的和指定级别以上的信息都会被记录。如果这个参数配置时遗漏了,就会默认使用error级别。
要记录debug信息日志,nginx在编译的时候要用–with-debug编译。
从1.7.11版本开始,这条指令也可以定义在stream级上,从1.9.0开始,可以记录在mail级上。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值