Is it possible to specify custom error log format on Nginx?

后端 未结 3 2165
悲&欢浪女
悲&欢浪女 2021-01-01 10:39

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?

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-01 11:17

    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:

    1. in the main section - error
    2. in the HTTP section - crit
    3. in the server section - crit

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

提交回复
热议问题