Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit66229ac

Browse files
committed
Introduce a LOG_SERVER_ONLY ereport level, which is never sent to client.
This elevel is useful for logging audit messages and similar informationthat should not be passed to the client. It's equivalent to LOG in termsof decisions about logging priority in the postmaster log, but messageswith this elevel will never be sent to the client.In the current implementation, it's just an alias for the longstandingCOMMERROR elevel (or more accurately, we've made COMMERROR an alias forthis). At some point it might be interesting to allow a LOG_ONLY flag tobe attached to any elevel, but that would be considerably more complicated,and it's not clear there's enough use-cases to justify the extra work.For now, let's just take the easy 90% solution.David Steele, reviewed by Fabien Coelho, Petr Jelínek, and myself
1 parent58666ed commit66229ac

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

‎src/backend/utils/error/elog.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ errstart(int elevel, const char *filename, int lineno,
293293
output_to_server=is_log_level_output(elevel,log_min_messages);
294294

295295
/* Determine whether message is enabled for client output */
296-
if (whereToSendOutput==DestRemote&&elevel!=COMMERROR)
296+
if (whereToSendOutput==DestRemote&&elevel!=LOG_SERVER_ONLY)
297297
{
298298
/*
299299
* client_min_messages is honored only after we complete the
@@ -2086,7 +2086,7 @@ write_eventlog(int level, const char *line, int len)
20862086
caseDEBUG2:
20872087
caseDEBUG1:
20882088
caseLOG:
2089-
caseCOMMERROR:
2089+
caseLOG_SERVER_ONLY:
20902090
caseINFO:
20912091
caseNOTICE:
20922092
eventlevel=EVENTLOG_INFORMATION_TYPE;
@@ -2965,7 +2965,7 @@ send_message_to_server_log(ErrorData *edata)
29652965
syslog_level=LOG_DEBUG;
29662966
break;
29672967
caseLOG:
2968-
caseCOMMERROR:
2968+
caseLOG_SERVER_ONLY:
29692969
caseINFO:
29702970
syslog_level=LOG_INFO;
29712971
break;
@@ -3595,7 +3595,7 @@ error_severity(int elevel)
35953595
prefix=_("DEBUG");
35963596
break;
35973597
caseLOG:
3598-
caseCOMMERROR:
3598+
caseLOG_SERVER_ONLY:
35993599
prefix=_("LOG");
36003600
break;
36013601
caseINFO:
@@ -3699,7 +3699,7 @@ write_stderr(const char *fmt,...)
36993699
staticbool
37003700
is_log_level_output(intelevel,intlog_min_level)
37013701
{
3702-
if (elevel==LOG||elevel==COMMERROR)
3702+
if (elevel==LOG||elevel==LOG_SERVER_ONLY)
37033703
{
37043704
if (log_min_level==LOG||log_min_level <=ERROR)
37053705
return true;

‎src/include/utils/elog.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@
2525
#defineDEBUG114/* used by GUC debug_* variables */
2626
#defineLOG15/* Server operational messages; sent only to
2727
* server log by default. */
28-
#defineCOMMERROR16/* Client communication problems; same as LOG
29-
* for server reporting, but never sent to
30-
* client. */
28+
#defineLOG_SERVER_ONLY 16/* Same as LOG for server reporting, but never
29+
* sent to client. */
30+
#defineCOMMERRORLOG_SERVER_ONLY/* Client communication problems; same
31+
* as LOG for server reporting, but
32+
* never sent to client. */
3133
#defineINFO17/* Messages specifically requested by user (eg
3234
* VACUUM VERBOSE output); always sent to
3335
* client regardless of client_min_messages,
@@ -354,7 +356,7 @@ typedef struct ErrorData
354356
char*detail_log;/* detail error message for server log only */
355357
char*hint;/* hint message */
356358
char*context;/* context message */
357-
constchar*message_id;/* message idof .message(originalEnglish text) */
359+
constchar*message_id;/*primarymessage's id (originalstring) */
358360
char*schema_name;/* name of schema */
359361
char*table_name;/* name of table */
360362
char*column_name;/* name of column */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp