Skip to content

Commit ed63689

Browse files
committed
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
1 parent 65790b9 commit ed63689

File tree

1 file changed

+30
-29
lines changed

1 file changed

+30
-29
lines changed

src/backend/utils/error/elog.c

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
*
4343
*
4444
* IDENTIFICATION
45-
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.161 2005/06/10 20:48:54 tgl Exp $
45+
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.162 2005/08/12 21:36:59 momjian Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -1266,6 +1266,7 @@ write_syslog(int level, const char *line)
12661266
static void
12671267
write_eventlog(int level, const char *line)
12681268
{
1269+
int eventlevel = EVENTLOG_ERROR_TYPE;
12691270
static HANDLE evtHandle = INVALID_HANDLE_VALUE;
12701271

12711272
if (evtHandle == INVALID_HANDLE_VALUE)
@@ -1278,8 +1279,33 @@ write_eventlog(int level, const char *line)
12781279
}
12791280
}
12801281

1282+
switch (level)
1283+
{
1284+
case DEBUG5:
1285+
case DEBUG4:
1286+
case DEBUG3:
1287+
case DEBUG2:
1288+
case DEBUG1:
1289+
case LOG:
1290+
case COMMERROR:
1291+
case INFO:
1292+
case NOTICE:
1293+
eventlevel = EVENTLOG_INFORMATION_TYPE;
1294+
break;
1295+
case WARNING:
1296+
eventlevel = EVENTLOG_WARNING_TYPE;
1297+
break;
1298+
case ERROR:
1299+
case FATAL:
1300+
case PANIC:
1301+
default:
1302+
eventlevel = EVENTLOG_ERROR_TYPE;
1303+
break;
1304+
}
1305+
1306+
12811307
ReportEvent(evtHandle,
1282-
level,
1308+
eventlevel,
12831309
0,
12841310
0, /* All events are Id 0 */
12851311
NULL,
@@ -1634,32 +1660,7 @@ send_message_to_server_log(ErrorData *edata)
16341660
/* Write to eventlog, if enabled */
16351661
if (Log_destination & LOG_DESTINATION_EVENTLOG)
16361662
{
1637-
int eventlog_level;
1638-
1639-
switch (edata->elevel)
1640-
{
1641-
case DEBUG5:
1642-
case DEBUG4:
1643-
case DEBUG3:
1644-
case DEBUG2:
1645-
case DEBUG1:
1646-
case LOG:
1647-
case COMMERROR:
1648-
case INFO:
1649-
case NOTICE:
1650-
eventlog_level = EVENTLOG_INFORMATION_TYPE;
1651-
break;
1652-
case WARNING:
1653-
eventlog_level = EVENTLOG_WARNING_TYPE;
1654-
break;
1655-
case ERROR:
1656-
case FATAL:
1657-
case PANIC:
1658-
default:
1659-
eventlog_level = EVENTLOG_ERROR_TYPE;
1660-
break;
1661-
}
1662-
write_eventlog(eventlog_level, buf.data);
1663+
write_eventlog(edata->elevel, buf.data);
16631664
}
16641665
#endif /* WIN32 */
16651666

@@ -1675,7 +1676,7 @@ send_message_to_server_log(ErrorData *edata)
16751676
* because that's really a pipe to the syslogger process.
16761677
*/
16771678
if ((!Redirect_stderr || am_syslogger) && pgwin32_is_service())
1678-
write_eventlog(EVENTLOG_ERROR_TYPE, buf.data);
1679+
write_eventlog(edata->elevel, buf.data);
16791680
else
16801681
#endif
16811682
fprintf(stderr, "%s", buf.data);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy