summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2007-02-11 15:12:48 +0000
committerMagnus Hagander <magnus@hagander.net>2007-02-11 15:12:48 +0000
commitb8a26a624070d2f6de7e1e75bad7ac32cb8b2b33 (patch)
tree23a4a74fcffe07ebbeae59f774eaf7b4f4011606
parentd6e3ae48ef4822259b00fe5fabd9791a30c19387 (diff)
Fix for early log messages during postmaster startup getting lost when
running as a service on Win32. Per report from Harald Armin Massa. Backpatch to 8.1.
-rw-r--r--src/backend/postmaster/postmaster.c6
-rw-r--r--src/backend/utils/error/elog.c9
2 files changed, 9 insertions, 6 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index a7858c40989..09485ed5f93 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.475.2.6 2006/07/16 18:17:23 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.475.2.7 2007/02/11 15:12:48 mha Exp $
*
* NOTES
*
@@ -211,8 +211,8 @@ static pid_t StartupPID = 0,
BgWriterPID = 0,
AutoVacPID = 0,
PgArchPID = 0,
- PgStatPID = 0,
- SysLoggerPID = 0;
+ PgStatPID = 0;
+pid_t SysLoggerPID = 0; /* Needs to be accessed from elog.c */
/* Startup/shutdown state */
#define NoShutdown 0
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 866662a65e6..a5c61858a85 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -42,7 +42,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.167.2.1 2005/11/22 18:23:23 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.167.2.2 2007/02/11 15:12:48 mha Exp $
*
*-------------------------------------------------------------------------
*/
@@ -75,6 +75,8 @@ ErrorContextCallback *error_context_stack = NULL;
sigjmp_buf *PG_exception_stack = NULL;
+extern pid_t SysLoggerPID;
+
/* GUC parameters */
PGErrorVerbosity Log_error_verbosity = PGERROR_VERBOSE;
char *Log_line_prefix = NULL; /* format for extra log line info */
@@ -1701,9 +1703,10 @@ send_message_to_server_log(ErrorData *edata)
* anything going there and write it to the eventlog instead.
*
* If stderr redirection is active, it's ok to write to stderr because
- * that's really a pipe to the syslogger process.
+ * that's really a pipe to the syslogger process. Unless we're in the
+ * postmaster, and the syslogger process isn't started yet.
*/
- if ((!Redirect_stderr || am_syslogger) && pgwin32_is_service())
+ if ((!Redirect_stderr || am_syslogger || (!IsUnderPostmaster && SysLoggerPID==0)) && pgwin32_is_service())
write_eventlog(edata->elevel, buf.data);
else
#endif