Re: elog vs errmsg_internal

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: elog vs errmsg_internal
Date: 2017-08-03 20:40:28
Message-ID: 20170803204028.numvecfqn7sghqws@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut wrote:
> Is there a preferred method to select between using elog() and
> errmsg_internal()?
>
> Attached is a patch that converts some DEBUG messages to one of those
> two to remove them from translation, but I'm not sure which one to pick
> other than by random aesthetics.

I think the contrib changes are probably not useful, since contrib is
not a target for nls anyway.

I'm not sure that all DEBUG messages should stay untranslated. If main
log messages (i.e. NOTICE/LOG and above) are translated, why not debug?
For example the ones in index.c and indexcmds.c. I agree that many of
these debugs are useless when translated, but not all. Clearly, it's a
judgement call which ones to mark for translation.

Some other random thoughts in the same area:

* I think translated messages in the server log are mostly an
operational failure. I think we should default to C, perhaps offer
translation as an option that's not enabled by default. Of course,
messages sent to client should be translated just like currently.

* Much worse is the fact that we send messages to the log in the
database encoding. This means that having a server log mixing lines
from databases with different encodings is a failure; it's just not
possible to read the log at all. A simple fix would be to transliterate
all messages to some common encoding (UTF8) so that at the log
file can at least be opened. Another fix would be to have multiple log
files, one per encoding; or maybe go for one per database. Neither of
these proposals seem particularly great. Simply keeping the server log
in C locale would fix this problem too.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2017-08-03 20:45:30 Re: Macros bundling RELKIND_* conditions
Previous Message Peter Eisentraut 2017-08-03 20:26:13 elog vs errmsg_internal