Re: BUG #1466: syslogger issues

From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "Andreas Pflug" <pgadmin(at)pse-consulting(dot)de>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "PostgreSQL-patches" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: BUG #1466: syslogger issues
Date: 2005-02-21 19:56:57
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCE476936@algol.sollentuna.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

>>>>There is special code in the send_message_to_server_log
>>>
>>>function to make
>>>
>>>>sure it's written directly to the file.
>>>
>>>If the logger is complaining, it's quite possibly because it's
>>>unable to
>>>write to its file. Now that you mention it, doesn't this
>code go into
>>>infinite recursion if write_syslogger_file_binary() tries to ereport?
>
>Yes, apparently.
>
>Actually, elog.c code should look like this:
>
>if ((Log_destination & LOG_DESTINATION_STDERR) ...)
>{
> if (am_syslogger)
> write_syslogger_file(buf.data, buf.len);
> else
> fwrite(buf.data, 1, buf.len, stderr);
>}
>
>This avoids unnecessary pipe traffic (which might fail too)
>and gettext translation.

That's sort of what I thought, but without being certain at all.

>Next, the elog call in write_syslogger_file_binary will almost
>certainly
>loop, so it should call write_stderr then (since eventlog is usually
>fixed-size with cyclic writing, even in out-of-disk-space conditions
>something might get logged).

Ok. I've included these changes in the attached patch. Haven't tested
those specific codepaths, but the other changes still work...

>3rd, I've been proposing to have redirect_stderr=true on by default at
>least on win32 earlier, I still think this is reasonable.

It's already the default if you install from the MSI installer.

//Magnus

Attachment Content-Type Size
stderr.patch application/octet-stream 2.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2005-02-21 20:00:23 Re: sigint psql
Previous Message Greg Sabino Mullane 2005-02-21 18:17:34 Re: Get rid of system attributes in pg_attribute?

Browse pgsql-patches by date

  From Date Subject
Next Message Simon Riggs 2005-02-21 20:48:55 Re: Patch for disaster recovery
Previous Message David Fetter 2005-02-21 19:21:34 Re: Change < to -f in examples with input files