|
42 | 42 | *
|
43 | 43 | *
|
44 | 44 | * IDENTIFICATION
|
45 |
| - * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.156 2005/02/22 04:37:38 momjian Exp $ |
| 45 | + * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.157 2005/02/27 01:02:57 momjian Exp $ |
46 | 46 | *
|
47 | 47 | *-------------------------------------------------------------------------
|
48 | 48 | */
|
@@ -1630,7 +1630,18 @@ send_message_to_server_log(ErrorData *edata)
|
1630 | 1630 | #endif/* WIN32 */
|
1631 | 1631 | /* Write to stderr, if enabled */
|
1632 | 1632 | if ((Log_destination&LOG_DESTINATION_STDERR)||whereToSendOutput==Debug)
|
| 1633 | +{ |
| 1634 | +#ifdefWIN32 |
| 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. */ |
| 1639 | +if ((!Redirect_stderr||am_syslogger)&&pgwin32_is_service()) |
| 1640 | +write_eventlog(EVENTLOG_ERROR_TYPE,buf.data); |
| 1641 | +else |
| 1642 | +#endif |
1633 | 1643 | fprintf(stderr,"%s",buf.data);
|
| 1644 | +} |
1634 | 1645 |
|
1635 | 1646 | /* If in the syslogger process, try to write messages direct to file */
|
1636 | 1647 | if (am_syslogger)
|
|