aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_log.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-09-28 20:09:22 +0000
committerIgor Sysoev <igor@sysoev.ru>2004-09-28 20:09:22 +0000
commit55168f6b6bca2d9aafc11ada25b514f7ac99d34f (patch)
tree8eb8853ebf981ab6a452736f527bcbc60132625c /src/core/ngx_log.c
parente0eaacd795530fa5c697594cdde4caa1e826efab (diff)
downloadnginx-55168f6b6bca2d9aafc11ada25b514f7ac99d34f.tar.gz
nginx-55168f6b6bca2d9aafc11ada25b514f7ac99d34f.zip
nginx-0.1.0-2004-09-29-00:09:22 import
Diffstat (limited to 'src/core/ngx_log.c')
-rw-r--r--src/core/ngx_log.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c
index b23d8bba1..be899e3f7 100644
--- a/src/core/ngx_log.c
+++ b/src/core/ngx_log.c
@@ -259,6 +259,8 @@ void ngx_log_stderr(ngx_event_t *ev)
ngx_log_t *ngx_log_init_errlog()
{
+ ngx_fd_t fd;
+
#if (WIN32)
ngx_stderr.fd = GetStdHandle(STD_ERROR_HANDLE);
@@ -283,7 +285,37 @@ ngx_log_t *ngx_log_init_errlog()
#endif
ngx_log.file = &ngx_stderr;
- ngx_log.log_level = NGX_LOG_INFO;
+ ngx_log.log_level = NGX_LOG_ERR;
+
+#if 0
+ fd = ngx_open_file(NGX_ERROR_LOG_PATH, NGX_FILE_RDWR,
+ NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND);
+
+ if (fd == NGX_INVALID_FILE) {
+ ngx_log_error(NGX_LOG_EMERG, (&ngx_log), ngx_errno,
+ ngx_open_file_n " \"" NGX_ERROR_LOG_PATH "\" failed");
+ return NULL;
+ }
+
+#if (WIN32)
+
+ if (ngx_file_append_mode(fd) == NGX_ERROR) {
+ ngx_log_error(NGX_LOG_EMERG, (&ngx_log), ngx_errno,
+ ngx_file_append_mode_n " \"" NGX_ERROR_LOG_PATH
+ "\" failed");
+ return NULL;
+ }
+
+#else
+
+ if (dup2(fd, STDERR_FILENO) == NGX_ERROR) {
+ ngx_log_error(NGX_LOG_EMERG, (&ngx_log), ngx_errno,
+ "dup2(STDERR) failed");
+ return NULL;
+ }
+
+#endif
+#endif
return &ngx_log;
}