diff src/core/ngx_log.c @ 489:549994537f15 NGINX_0_7_52

nginx 0.7.52 *) Feature: the first native Windows binary release. *) Bugfix: in processing HEAD method while caching. *) Bugfix: in processing the "If-Modified-Since", "If-Range", etc. client request header lines while caching. *) Bugfix: now the "Set-Cookie" and "P3P" header lines are hidden in cacheable responses. *) Bugfix: if nginx was built with the ngx_http_perl_module and with a perl which supports threads, then during a master process exit the message "panic: MUTEX_LOCK" might be issued. *) Bugfix: nginx could not be built --without-http-cache; the bug had appeared in 0.7.48. *) Bugfix: nginx could not be built on platforms different from i386, amd64, sparc, and ppc; the bug had appeared in 0.7.42.
author Igor Sysoev <http://sysoev.ru>
date Mon, 20 Apr 2009 00:00:00 +0400
parents 6866b490272e
children 392c16f2d858
line wrap: on
line diff
--- a/src/core/ngx_log.c
+++ b/src/core/ngx_log.c
@@ -184,9 +184,30 @@ ngx_log_debug_core(ngx_log_t *log, ngx_e
 
 
 void
-ngx_log_abort(ngx_err_t err, const char *text)
+ngx_log_abort(ngx_err_t err, const char *text, void *param)
+{
+    ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, err, text, param);
+}
+
+
+void ngx_cdecl
+ngx_log_stderr(const char *fmt, ...)
 {
-    ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, err, text);
+    u_char   *p;
+    va_list   args;
+    u_char    errstr[NGX_MAX_ERROR_STR];
+
+    va_start(args, fmt);
+    p = ngx_vsnprintf(errstr, NGX_MAX_ERROR_STR, fmt, args);
+    va_end(args);
+
+    if (p > errstr + NGX_MAX_ERROR_STR - NGX_LINEFEED_SIZE) {
+        p = errstr + NGX_MAX_ERROR_STR - NGX_LINEFEED_SIZE;
+    }
+
+    ngx_linefeed(p);
+
+    (void) ngx_write_fd(ngx_stderr_fileno, errstr, p - errstr);
 }
 
 
@@ -206,9 +227,9 @@ ngx_log_init(void)
                                   NGX_FILE_DEFAULT_ACCESS);
 
     if (ngx_stderr.fd == NGX_INVALID_FILE) {
-        ngx_message_box("nginx", MB_OK, ngx_errno,
-                        "Could not open error log file: "
-                        ngx_open_file_n " \"" NGX_ERROR_LOG_PATH "\" failed");
+        ngx_event_log(ngx_errno, 
+                      "Could not open error log file: "
+                      ngx_open_file_n " \"" NGX_ERROR_LOG_PATH "\" failed");
         return NULL;
     }