Nginx error_log Log Configuration

Source: Internet
Author: User
On the parsing of error_log instruction


----nginx-1.0.9---

Error_log configuration:
Error_log Logs/xxx.log Error | Debug_core | Debug_alloc

Main () {//... prefix =./configure--prefix ngx_init_cycle (ngx_cycle_t *old_cycle) {Log.log_leve
        L = ngx_log_notice;
        Log = Ngx_log_init () = $prefix + Ngx_error_log_path = $prefix/logs/error.log; Ngx_conf_param (ngx_conf_t *cf) {Ngx_error_log () {cycle->new_log = $co
                Nf_prefix/logs/xxx.log or $prefix/logs/xxx.log;


                    Ngx_log_set_levels () {value = cf->args->elts; /* See from this code: the log level configuration for the Error_log directive is divided into error log level and debug log level, and error log can only be set one level and error log must be written in tune
                     Trial log level before and debug log can set multiple levels other configuration methods may not be up to your expectations.
                        * for (i = 2; i < cf->args->nelts; i++) {found = 0; for (n = 1; n <= ngx_log_debug n++) {if ngx_strcmp (Value[i].data, Err_levels[n ].data) = = 0) {/* This match is error log level * * Log->log_level = n;
                                Found = 1;
                            Break for (n = 0, d = ngx_log_debug_first d <= ngx_log_debug_last D &
                                Lt;<= 1) {//* This match is the debug log level */if (ngx_strcmp (Value[i].data, debug_levels[n++)) = = 0) {
                                Log->log_level |= D;
                                Found = 1;
                            Break
                        }} if (Log->log_level = ngx_log_debug) {
                    Log->log_level = Ngx_log_debug_all;
                return NGX_CONF_OK;
        }} Cycle->log = &cycle->new_log;


    Pool->log = &cycle->new_log;
 }
    //...
}



-----------
Summarize
Grammar:
Error_log file [Debug | info | notice | warn | error | crit] | [{debug_core | debug_alloc | debug_mutex | debug_event | debug_http | debug_mail | debug_mysql}]
Log level = error log Level | Debug log level; Or
Log level = error log level;
Level of error log: Emerg, alert, crit, error, warn, notic, info, Debug,
Level of debug log: Debug_core, Debug_alloc, Debug_mutex, Debug_event, Debug_http, Debug_mail, Debug_mysql,


The log level configuration for the Error_log directive is divided into error log level and debug log level
And the error log can be set only one level and the error log must be written at the front of the debug log level and the debug log may set multiple levels
Other configuration methods may not be up to your expectations.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.