Opened 8 years ago

Closed 8 years ago

#1077 closed defect (duplicate)

[1.11.4_1] error_log location not respected

Reported by: serge-vk@… Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.11.x
Keywords: nginx.conf error_log Cc:
uname -a: FreeBSD BSD-Web.local 10.3-RELEASE FreeBSD 10.3-RELEASE #0 r297264: Fri Mar 25 02:10:02 UTC 2016 root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
nginx -V: nginx version: nginx/1.11.4
built with OpenSSL 1.0.2h 3 May 2016
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 --modules-path=/usr/local/libexec/nginx --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=/var/ports/usr/ports/www/nginx-devel/work/ngx_cache_purge-2.3 --add-dynamic-module=/var/ports/usr/ports/www/nginx-devel/work/echo-nginx-module-46334b3 --with-http_geoip_module=dynamic --with-http_gzip_static_module --with-http_gunzip_module --with-http_perl_module=dynamic --add-module=/var/ports/usr/ports/www/nginx-devel/work/ngx_http_response-0.3 --add-module=/var/ports/usr/ports/www/nginx-devel/work/ngx_http_substitutions_filter_module-0.6.4 --with-http_secure_link_module --with-http_slice_module --with-http_stub_status_module --with-http_sub_module --add-module=/var/ports/usr/ports/www/nginx-devel/work/mod_zip-ca0b345 --add-module=/var/ports/usr/ports/www/nginx-devel/work/modsecurity-2.9.1/nginx/modsecurity --with-pcre --add-module=/var/ports/usr/ports/www/nginx-devel/work/redis2-nginx-module-0.12 --with-http_v2_module --with-stream=dynamic --with-stream_ssl_module --with-threads --with-http_ssl_module --add-dynamic-module=/var/ports/usr/ports/www/nginx-devel/work/ngx_brotli-ada972b

Description

Since the update from 1.11.3 to 1.11.4_1, Nginx does not respect custom locations of error logs (but does respect the access_log location).

Regardless of the presence of error_log statement in nginx.conf, the error log is always created in /var/log/nginx/error.log. If the /var/log/nginx folder is removed, an attempt to start nginx (service nginx start) or even test configuration (nginx -t) produces this error message, followed by start-up output normally sent to the error log:

nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (2: No such file or directory)

Downgrading to 1.11.3 restores normal behaviour

Change History (2)

comment:1 by serge-vk@…, 8 years ago

When nginx is started for the first time after upgrade to 1.11.4_1, /var/log/nginx/ folder is created with both error.log and access.log and nginx starts filling them with records (regardless of error_log and access_log settings). If later the file access.log is removed and nginx restarted, it does not re-create access.log.

comment:2 by Maxim Dounin, 8 years ago

Resolution: duplicate
Status: newclosed

The compiled-in error log is used during configuration parsing (before the error_log from nginx.conf is known), so there is no surprise it is always created, see #147.

As for the /var/log/nginx folder, it is created due to this change in the FreeBSD port. Previously, logging in the port defaulted to /var/log/nginx-access.log and /var/log/nginx-error.log.

What you wrote about the access.log file looks strange though. As far as I can see, the port doesn't create these files (it only creates the /var/log/nginx directory). On the other hand, the fact that access.log isn't re-created on restart suggests it's not an nginx problem either, as nginx doesn't know if it was started for the first time or not.

Closing this as duplicate of #147.

Note: See TracTickets for help on using tickets.