On second thought, the tests for what to do with stderr output are a
lot more sensible if we check the chunk-output case first. Not back-patched since it's just a cosmetic improvement.
This commit is contained in:
parent
4ca7a2dacb
commit
f812dd91fe
@ -42,7 +42,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.188 2007/07/19 19:13:43 adunstan Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.189 2007/07/19 21:58:12 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1770,28 +1770,26 @@ send_message_to_server_log(ErrorData *edata)
|
|||||||
/* Write to stderr, if enabled */
|
/* Write to stderr, if enabled */
|
||||||
if ((Log_destination & LOG_DESTINATION_STDERR) || whereToSendOutput == DestDebug)
|
if ((Log_destination & LOG_DESTINATION_STDERR) || whereToSendOutput == DestDebug)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Use the chunking protocol if we know the syslogger should
|
||||||
|
* be catching stderr output, and we are not ourselves the
|
||||||
|
* syslogger. Otherwise, just do a vanilla write to stderr.
|
||||||
|
*/
|
||||||
|
if (redirection_done && !am_syslogger)
|
||||||
|
write_pipe_chunks(fileno(stderr), buf.data, buf.len);
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In a win32 service environment, there is no usable stderr. Capture
|
* In a win32 service environment, there is no usable stderr. Capture
|
||||||
* anything going there and write it to the eventlog instead.
|
* anything going there and write it to the eventlog instead.
|
||||||
*
|
*
|
||||||
* If stderr redirection is active, it's ok to write to stderr because
|
* If stderr redirection is active, it was OK to write to stderr above
|
||||||
* that's really a pipe to the syslogger process. Unless we're in the
|
* because that's really a pipe to the syslogger process.
|
||||||
* postmaster, and the syslogger process isn't started yet.
|
|
||||||
*/
|
*/
|
||||||
if (pgwin32_is_service() && (!redirection_done || am_syslogger) )
|
else if (pgwin32_is_service())
|
||||||
write_eventlog(edata->elevel, buf.data);
|
write_eventlog(edata->elevel, buf.data);
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
/* only use the chunking protocol if we know the syslogger should
|
else
|
||||||
* be catching stderr output, and we are not ourselves the
|
write(fileno(stderr), buf.data, buf.len);
|
||||||
* 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If in the syslogger process, try to write messages direct to file */
|
/* If in the syslogger process, try to write messages direct to file */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user