]> granicus.if.org Git - postgresql/commitdiff
Fix for early log messages during postmaster startup getting lost when
authorMagnus Hagander <magnus@hagander.net>
Sun, 11 Feb 2007 11:59:26 +0000 (11:59 +0000)
committerMagnus Hagander <magnus@hagander.net>
Sun, 11 Feb 2007 11:59:26 +0000 (11:59 +0000)
running as a service on Win32.

Per report from Harald Armin Massa.

src/backend/postmaster/postmaster.c
src/backend/utils/error/elog.c

index 6b3bea6eb5e837b700fed415906cb0893d35aeb9..2c54ad7010e3649f79c4e867c54c6ed8a6a8a9e1 100644 (file)
@@ -37,7 +37,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.519 2007/02/10 14:58:54 petere Exp $
+ *       $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.520 2007/02/11 11:59:25 mha Exp $
  *
  * NOTES
  *
@@ -202,8 +202,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
index 7568b081afd610011863965a81c7db19cff1bd2a..3700c4ecdc08741e1777b0d6ad3d5c3e78fe0f47 100644 (file)
@@ -42,7 +42,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.181 2007/01/20 21:40:25 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.182 2007/02/11 11:59:26 mha Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -76,6 +76,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 */
@@ -1693,9 +1695,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