aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2005-08-12 21:38:00 +0000
committerBruce Momjian <bruce@momjian.us>2005-08-12 21:38:00 +0000
commit0c9f00506b9e473341f0ac0cd7296b61eb570301 (patch)
tree081c71162954cf45afb3bf4114fae301fc2da927 /src
parent18b15c39468ba0bed7455799745654457230322a (diff)
downloadpostgresql-0c9f00506b9e473341f0ac0cd7296b61eb570301.tar.gz
postgresql-0c9f00506b9e473341f0ac0cd7296b61eb570301.zip
This patch fixes the event type used to log output from the
stderr-in-service or output-from-syslogger-in-service code. Previously everything was flagged as ERRORs there, which caused all instances to log "LOG: logger shutting down" as error... Please apply for 8.1. I'd also like it considered for 8.0 since logging non-errors as errors can be cause for alarm amongst people who actually look at their logs... Magnus Hagander
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/error/elog.c59
1 files changed, 30 insertions, 29 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 88f3ec560a7..68d0b13a767 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.155.4.1 2005/03/12 01:55:15 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.155.4.2 2005/08/12 21:38:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1266,6 +1266,7 @@ write_syslog(int level, const char *line)
static void
write_eventlog(int level, const char *line)
{
+ int eventlevel = EVENTLOG_ERROR_TYPE;
static HANDLE evtHandle = INVALID_HANDLE_VALUE;
if (evtHandle == INVALID_HANDLE_VALUE)
@@ -1278,8 +1279,33 @@ write_eventlog(int level, const char *line)
}
}
+ switch (level)
+ {
+ case DEBUG5:
+ case DEBUG4:
+ case DEBUG3:
+ case DEBUG2:
+ case DEBUG1:
+ case LOG:
+ case COMMERROR:
+ case INFO:
+ case NOTICE:
+ eventlevel = EVENTLOG_INFORMATION_TYPE;
+ break;
+ case WARNING:
+ eventlevel = EVENTLOG_WARNING_TYPE;
+ break;
+ case ERROR:
+ case FATAL:
+ case PANIC:
+ default:
+ eventlevel = EVENTLOG_ERROR_TYPE;
+ break;
+ }
+
+
ReportEvent(evtHandle,
- level,
+ eventlevel,
0,
0, /* All events are Id 0 */
NULL,
@@ -1601,32 +1627,7 @@ send_message_to_server_log(ErrorData *edata)
/* Write to eventlog, if enabled */
if (Log_destination & LOG_DESTINATION_EVENTLOG)
{
- int eventlog_level;
-
- switch (edata->elevel)
- {
- case DEBUG5:
- case DEBUG4:
- case DEBUG3:
- case DEBUG2:
- case DEBUG1:
- case LOG:
- case COMMERROR:
- case INFO:
- case NOTICE:
- eventlog_level = EVENTLOG_INFORMATION_TYPE;
- break;
- case WARNING:
- eventlog_level = EVENTLOG_WARNING_TYPE;
- break;
- case ERROR:
- case FATAL:
- case PANIC:
- default:
- eventlog_level = EVENTLOG_ERROR_TYPE;
- break;
- }
- write_eventlog(eventlog_level, buf.data);
+ write_eventlog(edata->elevel, buf.data);
}
#endif /* WIN32 */
@@ -1642,7 +1643,7 @@ send_message_to_server_log(ErrorData *edata)
* because that's really a pipe to the syslogger process.
*/
if ((!Redirect_stderr || am_syslogger) && pgwin32_is_service())
- write_eventlog(EVENTLOG_ERROR_TYPE, buf.data);
+ write_eventlog(edata->elevel, buf.data);
else
#endif
fprintf(stderr, "%s", buf.data);