有没有可能在nginx中指定自定义错误日志格式? [英] Is it possible to specify custom error log format in nginx?
问题描述
我可以为nginx中的访问日志指定自定义日志格式,但是它不能用于错误日志。我希望当错误发生的时候我总是看到时间。是否有可能?
你不能指定你自己的格式,但是在nginx内建的几个级别的error_log- ing 。
语法:error_log file [debug |信息|通知|警告|错误|暴力]
$ b
默认值:$ {前缀} /logs/error.log
指定服务器和/或fastcgi)错误记录。
错误级别的默认值:
- 在主要部分 - 错误
- 在HTTP部分 - 暴击
- 在服务器部分 - crit
在我的error_log中,时间总是以日志中的每个错误字符串的形式出现。
I can specify custom log format for access log in nginx, but it won't work for error log. I wish I always saw time when error occur. Is it possible?
You can't specify your own format, but in nginx build-in several level's of error_log-ing.
Syntax: error_log file [ debug | info | notice | warn | error | crit ]
Default: ${prefix}/logs/error.log
Specifies the file where server (and fastcgi) errors are logged.
Default values for the error level:
- in the main section - error
- in the HTTP section - crit
- in the server section - crit
In my error_log, time always presented int begin of each error string in log.
这篇关于有没有可能在nginx中指定自定义错误日志格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!