issue start up errors and warning on both stderr and error_log
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c
index 476ba83..0c0fd8a 100644
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -270,7 +270,7 @@
     }
 
     if (ngx_test_config) {
-        ngx_log_stderr("the configuration file %s syntax is ok",
+        ngx_log_stderr(0, "the configuration file %s syntax is ok",
                        cycle->conf_file.data);
     }
 
@@ -582,25 +582,14 @@
 
     /* commit the new cycle configuration */
 
-#if !(NGX_WIN32)
+    if (!ngx_use_stderr && cycle->log->file->fd != ngx_stderr) {
 
-    if (!ngx_test_config && cycle->log->file->fd != STDERR_FILENO) {
-
-        ngx_log_debug3(NGX_LOG_DEBUG_CORE, log, 0,
-                       "dup2: %p %d \"%s\"",
-                       cycle->log->file,
-                       cycle->log->file->fd, cycle->log->file->name.data);
-
-        if (dup2(cycle->log->file->fd, STDERR_FILENO) == -1) {
-            ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
-                          "dup2(STDERR) failed");
-            /* fatal */
-            exit(1);
+        if (ngx_set_stderr(cycle->log->file->fd) == NGX_FILE_ERROR) {
+            ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
+                          ngx_set_stderr_n " failed");
         }
     }
 
-#endif
-
     pool->log = cycle->log;
 
     for (i = 0; ngx_modules[i]; i++) {
@@ -697,7 +686,7 @@
             i = 0;
         }
 
-        if (file[i].fd == NGX_INVALID_FILE || file[i].fd == ngx_stderr_fileno) {
+        if (file[i].fd == NGX_INVALID_FILE || file[i].fd == ngx_stderr) {
             continue;
         }
 
@@ -797,7 +786,7 @@
             i = 0;
         }
 
-        if (file[i].fd == NGX_INVALID_FILE || file[i].fd == ngx_stderr_fileno) {
+        if (file[i].fd == NGX_INVALID_FILE || file[i].fd == ngx_stderr) {
             continue;
         }