On 4/4/16 11:21 AM, Tom Lane wrote:
David Steele <da...@pgmasters.net> writes:
On 3/29/16 12:58 PM, Tom Lane wrote:
... Basically,
my point is that LOG_ONLY achieves 95% of the benefit for probably
0.01% of the work.
Attached is a patch that re-purposes COMMERROR as LOG_SERVER_ONLY. I
went ahead and replaced all instances of COMMERROR with LOG_SERVER_ONLY.
Uh, what? COMMERROR is a distinct concept in my opinion. It might happen
to share the same implementation today, but that doesn't make it the
same thing.
Fair enough.
I had in mind a patch that simply added LOG_SERVER_ONLY as another define
and did whatever seemed appropriate documentation-wise. I see no reason
to touch the places that are currently dealing with client communication
failures.
I still prefer to collapse them into a single value for the current
implementation. Otherwise there are several places that need to check
for both in elog.c and their behavior is identical (for now). For my 2c
it makes more sense to collapse COMMERROR into LOG_SERVER_ONLY since
that more accurately describes what it actually does in the elog code.
What do you think of the attached?
COMMERROR was not documented in sources.sgml so LOG_SERVER_ONLY wasn't
either. I'm happy to do that that though it's not clear to me where it
would go. I could just put it in the general description.
Thanks,
--
-David
da...@pgmasters.net
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 8e00609..740f089 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -293,7 +293,7 @@ errstart(int elevel, const char *filename, int lineno,
output_to_server = is_log_level_output(elevel, log_min_messages);
/* Determine whether message is enabled for client output */
- if (whereToSendOutput == DestRemote && elevel != COMMERROR)
+ if (whereToSendOutput == DestRemote && elevel != LOG_SERVER_ONLY)
{
/*
* client_min_messages is honored only after we complete the
@@ -2086,7 +2086,7 @@ write_eventlog(int level, const char *line, int len)
case DEBUG2:
case DEBUG1:
case LOG:
- case COMMERROR:
+ case LOG_SERVER_ONLY:
case INFO:
case NOTICE:
eventlevel = EVENTLOG_INFORMATION_TYPE;
@@ -2965,7 +2965,7 @@ send_message_to_server_log(ErrorData *edata)
syslog_level = LOG_DEBUG;
break;
case LOG:
- case COMMERROR:
+ case LOG_SERVER_ONLY:
case INFO:
syslog_level = LOG_INFO;
break;
@@ -3595,7 +3595,7 @@ error_severity(int elevel)
prefix = _("DEBUG");
break;
case LOG:
- case COMMERROR:
+ case LOG_SERVER_ONLY:
prefix = _("LOG");
break;
case INFO:
@@ -3699,7 +3699,7 @@ write_stderr(const char *fmt,...)
static bool
is_log_level_output(int elevel, int log_min_level)
{
- if (elevel == LOG || elevel == COMMERROR)
+ if (elevel == LOG || elevel == LOG_SERVER_ONLY)
{
if (log_min_level == LOG || log_min_level <= ERROR)
return true;
diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h
index 901651f..1d7fcca 100644
--- a/src/include/utils/elog.h
+++ b/src/include/utils/elog.h
@@ -25,9 +25,11 @@
#define DEBUG1 14 /* used by GUC debug_*
variables */
#define LOG 15 /* Server operational
messages; sent only to
* server log
by default. */
-#define COMMERROR 16 /* Client communication
problems; same as LOG
- * for server
reporting, but never sent to
- * client. */
+#define LOG_SERVER_ONLY 16 /* Same as LOG for server
reporting, but never
+ sent to
client. */
+#define COMMERROR LOG_SERVER_ONLY /* Client communication problems; same
as
+ LOG
for server reporting, but never sent
+ to
client. */
#define INFO 17 /* Messages specifically
requested by user (eg
* VACUUM
VERBOSE output); always sent to
* client
regardless of client_min_messages,
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers