Opened 7 years ago

Last modified 5 months ago

#147 assigned defect

nginx touched /var/log/nginx-error.log even when error_log are switched off

Reported by: subbsd@… Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.0.x
Keywords: Cc:
uname -a: FreeBSD t.my.domain 9.0-RELEASE FreeBSD 9.0-RELEASE #2: Fri Jan 6 02:41:28 MSK 2012 root@t.my.domain:/usr/obj/usr/src/sys/GENERIC amd64
nginx -V: nginx version: nginx/1.1.18 TLS SNI support enabled configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I /usr/local/include' --with-ld-opt='-L /usr/local/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx-error.log --user=www --group=www --with-file-aio --with-ipv6 --http-client-body-temp-path=/var/tmp/nginx/client_body_temp --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp --http-proxy-temp-path=/var/tmp/nginx/proxy_temp --http-scgi-temp-path=/var/tmp/nginx/scgi_temp --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp --http-log-path=/var/log/nginx-access.log --add-module=/usr/ports/www/nginx-devel/work/agentzh-headers-more-nginx-module-3580526 --with-http_geoip_module --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-http_stub_status_module --with-pcre

Description

Nginx create /var/log/nginx-error.log even when error_log switched off. nginx.conf:

error_log /dev/null;
events {

worker_connections 1024;

}

http {

error_log /dev/null;
access_log off;
server {

listen 80;
server_name localhost;
error_log /dev/null;

}

}

after:
% service nginx start

nginx-error.log in the /var/log directory created

Change History (6)

comment:1 Changed 7 years ago by mdounin

It's intentional behaviour introduce by Igor in 0.7.53:

    *) Change: now a log set by --error-log-path is created from the very
       start-up.

It was done to make sure configuration parsing errors are logged somewhere, especially during unattended boot when stderr isn't normally logged anywhere. The only way to avoid it as of now is to recompile nginx with --error-log-path=stderr.

While I don't consider this behaviour correct (and I actually tried to object at 0.7.53 times), it's highly unlikely to be changed due to Igor's position on this.

comment:2 Changed 6 years ago by maxim

  • Owner changed from somebody to sb
  • sensitive set to 0
  • Status changed from new to assigned

comment:3 Changed 6 years ago by maxim

  • Owner sb deleted

comment:4 Changed 11 months ago by mdounin

See also #1462.

comment:5 Changed 6 months ago by ru

See also #1583.

comment:6 Changed 5 months ago by mdounin

See also #1592.

Note: See TracTickets for help on using tickets.