Skip to content

Commit b8188e1

Browse files
committed
Fix for early log messages during postmaster startup getting lost when
running as a service on Win32. Per report from Harald Armin Massa.
1 parent 4d16001 commit b8188e1

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.519 2007/02/10 14:58:54 petere Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.520 2007/02/11 11:59:25 mha Exp $
4141
*
4242
* NOTES
4343
*
@@ -202,8 +202,8 @@ static pid_t StartupPID = 0,
202202
BgWriterPID = 0,
203203
AutoVacPID = 0,
204204
PgArchPID = 0,
205-
PgStatPID = 0,
206-
SysLoggerPID = 0;
205+
PgStatPID = 0;
206+
pid_t SysLoggerPID = 0; /* Needs to be accessed from elog.c */
207207

208208
/* Startup/shutdown state */
209209
#define NoShutdown 0

src/backend/utils/error/elog.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
*
4343
*
4444
* IDENTIFICATION
45-
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.181 2007/01/20 21:40:25 tgl Exp $
45+
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.182 2007/02/11 11:59:26 mha Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -76,6 +76,8 @@ ErrorContextCallback *error_context_stack = NULL;
7676

7777
sigjmp_buf *PG_exception_stack = NULL;
7878

79+
extern pid_t SysLoggerPID;
80+
7981
/* GUC parameters */
8082
PGErrorVerbosity Log_error_verbosity = PGERROR_VERBOSE;
8183
char *Log_line_prefix = NULL; /* format for extra log line info */
@@ -1693,9 +1695,10 @@ send_message_to_server_log(ErrorData *edata)
16931695
* anything going there and write it to the eventlog instead.
16941696
*
16951697
* If stderr redirection is active, it's ok to write to stderr because
1696-
* that's really a pipe to the syslogger process.
1698+
* that's really a pipe to the syslogger process. Unless we're in the
1699+
* postmaster, and the syslogger process isn't started yet.
16971700
*/
1698-
if ((!Redirect_stderr || am_syslogger) && pgwin32_is_service())
1701+
if ((!Redirect_stderr || am_syslogger || (!IsUnderPostmaster && SysLoggerPID==0)) && pgwin32_is_service())
16991702
write_eventlog(edata->elevel, buf.data);
17001703
else
17011704
#endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy