|
42 | 42 | * |
43 | 43 | * |
44 | 44 | * IDENTIFICATION |
45 | | - * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.157 2005/02/27 01:02:57 momjian Exp $ |
| 45 | + * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.158 2005/03/12 01:54:44 tgl Exp $ |
46 | 46 | * |
47 | 47 | *------------------------------------------------------------------------- |
48 | 48 | */ |
@@ -1557,7 +1557,6 @@ send_message_to_server_log(ErrorData *edata) |
1557 | 1557 | appendStringInfoChar(&buf, '\n'); |
1558 | 1558 | } |
1559 | 1559 |
|
1560 | | - |
1561 | 1560 | #ifdef HAVE_SYSLOG |
1562 | 1561 | /* Write to syslog, if enabled */ |
1563 | 1562 | if (Log_destination & LOG_DESTINATION_SYSLOG) |
@@ -1597,7 +1596,9 @@ send_message_to_server_log(ErrorData *edata) |
1597 | 1596 | write_syslog(syslog_level, buf.data); |
1598 | 1597 | } |
1599 | 1598 | #endif /* HAVE_SYSLOG */ |
| 1599 | + |
1600 | 1600 | #ifdef WIN32 |
| 1601 | + /* Write to eventlog, if enabled */ |
1601 | 1602 | if (Log_destination & LOG_DESTINATION_EVENTLOG) |
1602 | 1603 | { |
1603 | 1604 | int eventlog_level; |
@@ -1628,19 +1629,23 @@ send_message_to_server_log(ErrorData *edata) |
1628 | 1629 | write_eventlog(eventlog_level, buf.data); |
1629 | 1630 | } |
1630 | 1631 | #endif /* WIN32 */ |
| 1632 | + |
1631 | 1633 | /* Write to stderr, if enabled */ |
1632 | 1634 | if ((Log_destination & LOG_DESTINATION_STDERR) || whereToSendOutput == Debug) |
1633 | 1635 | { |
1634 | 1636 | #ifdef WIN32 |
1635 | | - /* In a win32 service environment, there is no usable stderr. Capture |
1636 | | - anything going there and write it to the eventlog instead. |
1637 | | - If stderr redirection is active, leave it to stderr because the |
1638 | | - logger will capture it to a file. */ |
| 1637 | + /* |
| 1638 | + * In a win32 service environment, there is no usable stderr. Capture |
| 1639 | + * anything going there and write it to the eventlog instead. |
| 1640 | + * |
| 1641 | + * If stderr redirection is active, it's ok to write to stderr |
| 1642 | + * because that's really a pipe to the syslogger process. |
| 1643 | + */ |
1639 | 1644 | if ((!Redirect_stderr || am_syslogger) && pgwin32_is_service()) |
1640 | 1645 | write_eventlog(EVENTLOG_ERROR_TYPE, buf.data); |
1641 | 1646 | else |
1642 | 1647 | #endif |
1643 | | - fprintf(stderr, "%s", buf.data); |
| 1648 | + fprintf(stderr, "%s", buf.data); |
1644 | 1649 | } |
1645 | 1650 |
|
1646 | 1651 | /* If in the syslogger process, try to write messages direct to file */ |
|
0 commit comments