Opened 4 years ago

Closed 4 years ago

#1933 closed defect (duplicate)

nginx -t does not write to set error log

Reported by: unifiedstreaming@… Owned by:
Priority: minor Milestone:
Component: documentation Version: 1.16.x
Keywords: Cc:
uname -a: Linux a099eb06f9b8 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.16.0
configure arguments: --sbin-path=/usr/local/sbin --add-dynamic-module=/home/dude/nginx_mod_smooth_streaming-1.10.12


When error log is set to another file and using a higher loglevel nginx will

a) still log
b) write to the default logs/error.log file, not the set file

In other words

error_log logs/other-error.log warn;

has no effect on

ngx_log_error(NGX_LOG_NOTICE, cf->log, 0, " ...

(where 'cf' is of ngx_conf_t*)

I would expect nginx to not log (because log level is 'warn' and is the log levels match to write to 'other-error.log' - or do I misunderstand something?



Change History (1)

comment:1 by Maxim Dounin, 4 years ago

Resolution: duplicate
Status: newclosed

Configuration being parsed, including the log file and log level set in the configuration, is applied after the configuration is fully parsed, and only if there are no errors in the configuration. Parsing itself happens in the previous configuration context - in case of nginx -t, this implies default log level and logging to both stderr and compiled-in error log (can be set by the --error-log-path= parameter of the configure command).

Closing this as a duplicate of #147, which is somewhat related.

Note: See TracTickets for help on using tickets.