aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2005-02-27 01:02:57 +0000
committerBruce Momjian <bruce@momjian.us>2005-02-27 01:02:57 +0000
commit76fa5e6e183f41fe86379f70ff94314b63f011ce (patch)
tree45810ed57597cb8522049d1ef796ae53f51794a1 /src
parentafbc30e5d4e305a577006582dd3650cf8f9c371f (diff)
downloadpostgresql-76fa5e6e183f41fe86379f70ff94314b63f011ce.tar.gz
postgresql-76fa5e6e183f41fe86379f70ff94314b63f011ce.zip
Cause Win32 to output to the event log rather than stderr by default.
Magnus Hagander
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/error/elog.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 36474d0a90f..80b222913ec 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.156 2005/02/22 04:37:38 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.157 2005/02/27 01:02:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1630,7 +1630,18 @@ send_message_to_server_log(ErrorData *edata)
#endif /* WIN32 */
/* Write to stderr, if enabled */
if ((Log_destination & LOG_DESTINATION_STDERR) || whereToSendOutput == Debug)
+ {
+#ifdef WIN32
+ /* In a win32 service environment, there is no usable stderr. Capture
+ anything going there and write it to the eventlog instead.
+ If stderr redirection is active, leave it to stderr because the
+ logger will capture it to a file. */
+ if ((!Redirect_stderr || am_syslogger) && pgwin32_is_service())
+ write_eventlog(EVENTLOG_ERROR_TYPE, buf.data);
+ else
+#endif
fprintf(stderr, "%s", buf.data);
+ }
/* If in the syslogger process, try to write messages direct to file */
if (am_syslogger)