Re: syslog_line_prefix

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, jd(at)commandprompt(dot)com, Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org, Joshua Tolley <eggyknap(at)gmail(dot)com>
Subject: Re: syslog_line_prefix
Date: 2009-09-25 21:29:14
Message-ID: 603c8f070909251429r2f983ef6t490e10a2a3c1fac5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 25, 2009 at 5:01 PM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> On Fri, Sep 25, 2009 at 22:57, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>>
>> Magnus Hagander wrote:
>>>
>>> On Fri, Sep 25, 2009 at 22:17, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>>>
>>>>
>>>> Magnus Hagander wrote:
>>>>
>>>>>
>>>>> I definitely want both text and CSV output - which I can't have today.
>>>>>
>>>>
>>>> Sure you can. What makes you think you can't?
>>>>
>>>
>>> How do i do that? When I enable csv logging, it changes the log format
>>> to csv, and my plaintext logs don't end up in the logs anymore.
>>>
>>> Note that I'm not talking about syslog, I'm talking about the logging
>>> that goes through the logging collector, and is dealt with by
>>> PostgreSQL.
>>>
>>>
>>
>> log_destination = 'stderr, csvlog'
>
> Clearly that works. I wonder why that didn't work when I last tried it :S
>
> /me wipes the egg off.
>
> (it's still weird that it's called stderr when it's a logfile, but
> that's a different story)
>
>
> Without looking deeply at the code, does it also properly route these
> famous "messages from third party libraries" to both files?

Rather than looking at the code, I'd suggest testing it. But I bet it
does. The whole point of redirecting stderr specifically (rather than
logging to some other random fd we keep around) is to catch those
random messages, and it would be pretty silly to catch them and then
not bother processing them properly.

For whatever it's worth, I think your (as perceived by me) scorn
regarding this issue is off base. I have this problem all the time,
and not just in C, but also in Perl, shell scripts, etc. I can't tell
you how many times I've tried to write code to ensure that ALL error
messages get logged to some database, file, sent as an email message,
etc. and inevitably something happens that my clever plan fails to
catch, and the darn thing fails without alerting me. You have to have
a collector process to make failure detection robust, and it has to
capture stderr. Period, full stop.

...Robert

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua Tolley 2009-09-25 21:29:34 Re: syslog_line_prefix
Previous Message Joshua Tolley 2009-09-25 21:27:28 Re: syslog_line_prefix