Re: logging to a file - Mailing list pgsql-general

From Andrew Sullivan
Subject Re: logging to a file
Date
Msg-id 20020610163727.N4880@mail.libertyrms.com
Whole thread Raw
In response to logging to a file  (Vincent Stoessel <vincent@xaymaca.com>)
List pgsql-general
On Mon, Jun 10, 2002 at 03:20:47PM -0400, Vincent Stoessel wrote:
> OK, I'm sorry but I have been looking through
> the docs and can some tell me how I can specify
> a log file to capture my postgres debug messages?
> Don't want to use syslog.

This is a bit of a pin, because you have to redirect the STDOUT from
the postmaster somewhere.  The problem is rotating the files.

A colleague of mine wrote a nifty perl script that handles it.  I'd
send it along, but as I didn't write it, I can't.  (Hint: it uses
IPC::Open3 and IO::Handle.)  One serious disadvantage of this
approach is that you can't SIGHUP the postmaster without losing your
logs.

I played with D.J. Bernstein's multilog program, in his daemontools
package (at http://cr.yp.to/daemontools.html).  I had it working, but
it seemed a little Byzantine for our needs.  I may go back to it,
though, because of the SIGHUP issue, since 7.2.x doesn't read
pg_hba.conf without SIGHUP.

Both of these approaches exact a speed penalty if you use timestamps,
because syslog provides the timestamp info for you, whereas otherwise
the postmaster has to get the time itself.  There is a tiny but
measurable difference.

Finally, why not use syslog?  Our production environment (or, more
precisely, the hoops required to make any config changes in our
production environment) precludes the use of syslog.  But it's
probably the most flexible answer.

A

--
----
Andrew Sullivan                               87 Mowat Avenue
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M6K 3E3
                                         +1 416 646 3304 x110


pgsql-general by date:

Previous
From: terry@greatgulfhomes.com
Date:
Subject: Re: Help with data transfer please
Next
From: Tom Lane
Date:
Subject: Re: [SQL] VIEWs and FOREIGN keys