aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/error/elog.c
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2007-07-19 19:14:25 +0000
committerAndrew Dunstan <andrew@dunslane.net>2007-07-19 19:14:25 +0000
commit5a7d6179f6ffe6c6e99a8e7379131c4748b8ae4d (patch)
treea4fd588d5521e0ffb3dabbe612a033745801e8d2 /src/backend/utils/error/elog.c
parent6869810637f0f6204e2037c227dafad33a8ce3c1 (diff)
downloadpostgresql-5a7d6179f6ffe6c6e99a8e7379131c4748b8ae4d.tar.gz
postgresql-5a7d6179f6ffe6c6e99a8e7379131c4748b8ae4d.zip
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.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 49771ae349a..f835b21ef9c 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.178.2.2 2007/06/14 01:49:39 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.178.2.3 2007/07/19 19:14:25 adunstan Exp $
*
*-------------------------------------------------------------------------
*/
@@ -76,7 +76,7 @@ ErrorContextCallback *error_context_stack = NULL;
sigjmp_buf *PG_exception_stack = NULL;
-extern pid_t SysLoggerPID;
+extern bool redirection_done;
/* GUC parameters */
PGErrorVerbosity Log_error_verbosity = PGERROR_VERBOSE;
@@ -1720,11 +1720,15 @@ send_message_to_server_log(ErrorData *edata)
* 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 || (!IsUnderPostmaster && SysLoggerPID==0)) && pgwin32_is_service())
+ if (pgwin32_is_service() && (!redirection_done || am_syslogger) )
write_eventlog(edata->elevel, buf.data);
else
#endif
- if (Redirect_stderr)
+ /* only use the chunking protocol if we know the syslogger should
+ * be catching stderr output, and we are not ourselves the
+ * syslogger. Otherwise, go directly to stderr.
+ */
+ if (redirection_done && !am_syslogger)
write_pipe_chunks(fileno(stderr), buf.data, buf.len);
else
write(fileno(stderr), buf.data, buf.len);