是否可以在Nginx上指定自定义错误日志格式? [英] Is it possible to specify custom error log format on Nginx?

查看:782
本文介绍了是否可以在Nginx上指定自定义错误日志格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在Nginx上为access_log指定自定义日志格式,但不适用于error_log.

I can specify custom log format for access_log on Nginx, but it doesn't work for error_log.

反正有实现这一目标的方法吗?

Is there anyway to achieve this?

推荐答案

您无法指定自己的格式,但是在nginx中内置了error_log-ing的多个级别.

You can't specify your own format, but in nginx build-in several level's of error_log-ing.

语法:error_log file [ debug | info | notice | warn | error | crit ]

默认:${prefix}/logs/error.log

指定记录服务器(和fastcgi)错误的文件.

Specifies the file where server (and fastcgi) errors are logged.

错误级别的默认值:

  1. 在主要部分-错误
  2. 在HTTP部分-暴击
  3. 在服务器部分-暴击

在我的error_log中,总是在日志中每个错误字符串的开始处显示时间.

In my error_log, time always presented int begin of each error string in log.

这篇关于是否可以在Nginx上指定自定义错误日志格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆