Re: elog cleanup - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: elog cleanup
Date
Msg-id 200202190554.g1J5svS13450@candle.pha.pa.us
Whole thread Raw
In response to Re: elog cleanup  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: elog cleanup  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > [ 100K+ patch ]
>
> If you're going to hit every file in the backend in pursuit of this
> idea, *puh-leeze* get it right the FIRST time, rather than subjecting
> us all to multiple rounds of break-everyone-else's-patches-in-progress.
>
> Things you did not get right include: where's the PG_ prefix?
> And what happened to merging the debug-level mechanism with the
> error level codes?

Wow, what encouragement!  :-<

See later posting.  I didn't want a mammoth patch that no one could
review.  I will do the rename at the same time I apply the patch, if
everyone agrees.

> > o Add INFO level that prints only to the client
> > o Add LOG level to print messages only to the server log
>
> I still object strongly to this worldview.  The code should not have
> a hard-wired concept of which messages are for the client and which
> are for the log.

OK, I can't come up with a clean solution without hardwiring it.  If we
are warning someone about a sequence creation as part of SERIAL, it
makes no sense to send it to the server log, it is informational.  The
same goes with database startup messages and checkpoint log file
rotation, which go only to the server logs.  I don't see the value in
adding complexity when it isn't needed.

If you want a clean heiarchy, I guess you could put INFO below LOG, and
default the server level to LOG and the client level to INFO.  However,
the client is never going to see most LOG message, but it does have the
desired effect that INFO only goes to the client and LOG goes only to
the server (usually).  Seems less logical to me because LOG can't go to
the client, but it has the same effect if people prefer that.  Actually,
now that I think of it, several LOG message would go to the client.  The
old way was to make LOG == DEBUG, but if you do that, then the server
would see all the INFO message because LOG has to be less than INFO;  it
gets to be a mess.

Considering the number of people doing elog(), I think saying "Use LOG
for server-only, INFO for client-only, and NOTICE for both" is pretty
clear.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: elog cleanup
Next
From: Tom Lane
Date:
Subject: Re: elog cleanup