mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
- Fixed bug #52693 (configuration file errors are not logged to stderr)
This commit is contained in:
parent
306d08a0f5
commit
b72460a42f
@ -47,6 +47,7 @@ int fpm_init(int argc, char **argv, char *config, struct event_base **base) /* {
|
||||
return -1;
|
||||
}
|
||||
|
||||
fpm_stdio_init_final();
|
||||
zlog(ZLOG_NOTICE, "fpm is running, pid %d", (int) fpm_globals.parent_pid);
|
||||
|
||||
return 0;
|
||||
|
@ -41,7 +41,6 @@ int fpm_stdio_init_main() /* {{{ */
|
||||
|
||||
int fpm_stdio_init_final() /* {{{ */
|
||||
{
|
||||
zlog_set_level(fpm_globals.log_level);
|
||||
if (fpm_global_config.daemonize) {
|
||||
if (fpm_globals.error_log_fd != STDERR_FILENO) {
|
||||
/* there might be messages to stderr from libevent, we need to log them all */
|
||||
@ -50,8 +49,8 @@ int fpm_stdio_init_final() /* {{{ */
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
zlog_set_fd(fpm_globals.error_log_fd);
|
||||
}
|
||||
zlog_set_launched();
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
@ -251,6 +250,9 @@ int fpm_stdio_open_error_log(int reopen) /* {{{ */
|
||||
fd = fpm_globals.error_log_fd; /* for FD_CLOSEXEC to work */
|
||||
} else {
|
||||
fpm_globals.error_log_fd = fd;
|
||||
if (fpm_global_config.daemonize) {
|
||||
zlog_set_fd(fpm_globals.error_log_fd);
|
||||
}
|
||||
}
|
||||
fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
|
||||
return 0;
|
||||
|
@ -246,7 +246,7 @@ int fpm_unix_init_main() /* {{{ */
|
||||
}
|
||||
}
|
||||
|
||||
fpm_stdio_init_final();
|
||||
zlog_set_level(fpm_globals.log_level);
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
static int zlog_fd = -1;
|
||||
static int zlog_level = ZLOG_NOTICE;
|
||||
static int launched = 0;
|
||||
|
||||
static const char *level_names[] = {
|
||||
[ZLOG_DEBUG] = "DEBUG",
|
||||
@ -27,6 +28,10 @@ static const char *level_names[] = {
|
||||
[ZLOG_ALERT] = "ALERT",
|
||||
};
|
||||
|
||||
void zlog_set_launched(void) {
|
||||
launched = 1;
|
||||
}
|
||||
|
||||
size_t zlog_print_time(struct timeval *tv, char *timebuf, size_t timebuf_len) /* {{{ */
|
||||
{
|
||||
struct tm t;
|
||||
@ -110,6 +115,9 @@ void zlog_ex(const char *function, int line, int flags, const char *fmt, ...) /*
|
||||
|
||||
buf[len++] = '\n';
|
||||
write(zlog_fd > -1 ? zlog_fd : STDERR_FILENO, buf, len);
|
||||
if (zlog_fd != STDERR_FILENO && zlog_fd > -1 && !launched && (flags & ZLOG_LEVEL_MASK) >= ZLOG_WARNING) {
|
||||
write(STDERR_FILENO, buf, len);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -11,6 +11,7 @@ struct timeval;
|
||||
|
||||
int zlog_set_fd(int new_fd);
|
||||
int zlog_set_level(int new_value);
|
||||
void zlog_set_launched(void);
|
||||
|
||||
size_t zlog_print_time(struct timeval *tv, char *timebuf, size_t timebuf_len);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user