Welcome! Log In Create A New Profile

Advanced

[Patch] Option to not use the default error log file during startup

Hongli Lai
November 13, 2010 09:26AM
Nginx always tries to open its default log file ($prefix/log/error.log)
even if I specified a different error_log in the config file. This is
done inside ngx_log_init(). This has two implications:

1. All errors that occur before the error log - as specified in the
config file - is opened, will be printed to the default error log and to
stderr.
2. If the default error log cannot be opened, e.g. because of
permissions, Nginx will print a warning.

(1) is fine for most cases where the user did not specify a different
error log. Nginx will, in those cases, write pre-config-load errors to
the error log file that the user expects as well as to stderr. However I
have a setup in which many different users use the same Nginx
executable, but each one with a different config file and error log
file. Users do not have write permission to the default error log file,
so because of (2), Nginx always prints the warning, which can be
confusing to them.

Ideally I would like Nginx to always write to the error log file as
specified in the config, and never to the default error log file, but it
seems that the codebase does not allow this and assumes logging
facilities to be available even before the config file is loaded.

Attached to this email is a patch which modifies ngx_log_init() to
ignore the default error log file if the environment variable
NGX_EARLY_LOG_TO_STDERR is set.

Attachments:
http://www.ruby-forum.com/attachment/5362/0001-Add-an-option-to-ignore-the-default-error-log-file-d.pa


--
Posted via http://www.ruby-forum.com/.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

[Patch] Option to not use the default error log file during startup

Hongli Lai November 13, 2010 09:26AM

Re: [Patch] Option to not use the default error log file during startup

Maxim Dounin November 13, 2010 09:56AM

Re: Option to not use the default error log file during startup

Hongli Lai November 17, 2010 08:44PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 152
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready