diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2007-07-19 19:15:25 +0000 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2007-07-19 19:15:25 +0000 |
commit | 19c9660ca8e87cee53d80dc4e2c19b4530c44264 (patch) | |
tree | 2dfda435db854c4e56f76ec0f10ea5985f57830b /src/backend/utils/error/elog.c | |
parent | a41c4b218fc7a67234fa657a0b611fea70ddd394 (diff) |
Only use the pipe chunking protocol if we know the syslogger should
be catching stderr output, and we are not ourselves the
syslogger. Otherwise, go directly to stderr.
Bug noticed by Tom Lane.
Backpatch as far as 8.0.
Diffstat (limited to 'src/backend/utils/error/elog.c')
-rw-r--r-- | src/backend/utils/error/elog.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 0d019167773..61039b66d8b 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.155.4.5 2007/06/14 01:50:34 adunstan Exp $ + * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.155.4.6 2007/07/19 19:15:25 adunstan Exp $ * *------------------------------------------------------------------------- */ @@ -75,6 +75,8 @@ ErrorContextCallback *error_context_stack = NULL; sigjmp_buf *PG_exception_stack = NULL; +extern bool redirection_done; + /* GUC parameters */ PGErrorVerbosity Log_error_verbosity = PGERROR_VERBOSE; char *Log_line_prefix = NULL; /* format for extra log line info */ @@ -1670,11 +1672,11 @@ send_message_to_server_log(ErrorData *edata) * If stderr redirection is active, it's ok to write to stderr * because that's really a pipe to the syslogger process. */ - if ((!Redirect_stderr || am_syslogger) && pgwin32_is_service()) + if (pgwin32_is_service() && (!redirection_done || am_syslogger) ) write_eventlog(edata->elevel, buf.data); else #endif - if (Redirect_stderr) + if (redirection_done && !am_syslogger) write_pipe_chunks(fileno(stderr), buf.data, buf.len); else write(fileno(stderr), buf.data, buf.len); |