Re: logging to a file

From: Andrew Sullivan <andrew(at)libertyrms(dot)info>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: logging to a file
Date: 2002-06-10 20:37:27
Message-ID: 20020610163727.N4880@mail.libertyrms.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)libertyrms(dot)info> M6K 3E3
+1 416 646 3304 x110

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-06-10 20:38:20 Re: [SQL] VIEWs and FOREIGN keys
Previous Message terry 2002-06-10 20:30:26 Re: Help with data transfer please