|
42 | 42 | *
|
43 | 43 | *
|
44 | 44 | * IDENTIFICATION
|
45 |
| - * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.188 2007/07/19 19:13:43 adunstan Exp $ |
| 45 | + * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.189 2007/07/19 21:58:12 tgl Exp $ |
46 | 46 | *
|
47 | 47 | *-------------------------------------------------------------------------
|
48 | 48 | */
|
@@ -1770,28 +1770,26 @@ send_message_to_server_log(ErrorData *edata)
|
1770 | 1770 | /* Write to stderr, if enabled */
|
1771 | 1771 | if ((Log_destination & LOG_DESTINATION_STDERR) || whereToSendOutput == DestDebug)
|
1772 | 1772 | {
|
| 1773 | + /* |
| 1774 | + * Use the chunking protocol if we know the syslogger should |
| 1775 | + * be catching stderr output, and we are not ourselves the |
| 1776 | + * syslogger. Otherwise, just do a vanilla write to stderr. |
| 1777 | + */ |
| 1778 | + if (redirection_done && !am_syslogger) |
| 1779 | + write_pipe_chunks(fileno(stderr), buf.data, buf.len); |
1773 | 1780 | #ifdef WIN32
|
1774 |
| - |
1775 | 1781 | /*
|
1776 | 1782 | * In a win32 service environment, there is no usable stderr. Capture
|
1777 | 1783 | * anything going there and write it to the eventlog instead.
|
1778 | 1784 | *
|
1779 |
| - * If stderr redirection is active, it's ok to write to stderr because |
1780 |
| - * that's really a pipe to the syslogger process. Unless we're in the |
1781 |
| - * postmaster, and the syslogger process isn't started yet. |
| 1785 | + * If stderr redirection is active, it was OK to write to stderr above |
| 1786 | + * because that's really a pipe to the syslogger process. |
1782 | 1787 | */
|
1783 |
| - if (pgwin32_is_service() && (!redirection_done || am_syslogger) ) |
| 1788 | + else if (pgwin32_is_service()) |
1784 | 1789 | write_eventlog(edata->elevel, buf.data);
|
1785 |
| - else |
1786 | 1790 | #endif
|
1787 |
| - /* only use the chunking protocol if we know the syslogger should |
1788 |
| - * be catching stderr output, and we are not ourselves the |
1789 |
| - * syslogger. Otherwise, go directly to stderr. |
1790 |
| - */ |
1791 |
| - if (redirection_done && !am_syslogger) |
1792 |
| - write_pipe_chunks(fileno(stderr), buf.data, buf.len); |
1793 |
| - else |
1794 |
| - write(fileno(stderr), buf.data, buf.len); |
| 1791 | + else |
| 1792 | + write(fileno(stderr), buf.data, buf.len); |
1795 | 1793 | }
|
1796 | 1794 |
|
1797 | 1795 | /* If in the syslogger process, try to write messages direct to file */
|
|
0 commit comments