<quote who="Andrew Hammond">
> Tom Lane wrote:
>> Andrew Hammond <ahammond@ca.afilias.info> writes:
>>>I've attached a patch for pg_ctl which integrates the Apache project's
rotatelogs for logging.
>> Why bother?  You just pipe pg_ctl's output to rotatelogs and you're done.
>
> It's not difficult to do, once you know how and once you know that there
aren't any gotchas. However, the question comes up often enough it's
clear that not everybody knows how. This provides a simple, clean,
standardized way of using rotatelog. The patch is simple, low risk, and
limited impact. So, why not?
>

Is there a reason the postmasters cannot just close/reopen-recreate the
log file when a SIGHUP or other signal is issued like apache?  This would
allow for almost any scheme for log rotation to be handled by the system
or third party like logrotate and removes any duplicate effort between
projects.

I know on most distributions /var/log is not world writeable, so renaming
and and opening a file as postgres will not succeed.   If the log files
are put in, for example, /var/log/pgsql with pgsql being rwx by postgres,
then it will work.  The current packaging may need to be redone if you
want to enable loggin by default (if only startup and shutdown messages)






Tue, 13 Apr 2004 09:33:42 -0500 (CDT)
"Thomas Swan" <tswan@idigx.com>
Re: rotatelogs integration in pg_ctl
On Tue, Apr 13, 2004 at 09:33:42 -0500,
  Thomas Swan <tswan@idigx.com> wrote:
> 
> Is there a reason the postmasters cannot just close/reopen-recreate the
> log file when a SIGHUP or other signal is issued like apache?  This would
> allow for almost any scheme for log rotation to be handled by the system
> or third party like logrotate and removes any duplicate effort between
> projects.

Wouldn't that break logs piped to a program?

Tue, 13 Apr 2004 10:02:57 -0500
Bruno Wolff III <bruno@wolff.to>
Re: rotatelogs integration in pg_ctl
Thomas Swan wrote:
> Is there a reason the postmasters cannot just close/reopen-recreate
> the log file when a SIGHUP or other signal is issued like apache? 

Yes, because there is no "log file".  The postmaster writes to stdout or 
stderr.


Tue, 13 Apr 2004 17:03:49 +0200
Peter Eisentraut <peter_e@gmx.net>
Re: rotatelogs integration in pg_ctl
<quote who="Peter Eisentraut">
> Thomas Swan wrote:
>> Is there a reason the postmasters cannot just close/reopen-recreate
>> the log file when a SIGHUP or other signal is issued like apache?
>
> Yes, because there is no "log file".  The postmaster writes to stdout or
> stderr.
>
>

Ok, my misunderstanding.  stdout/stderr are redirected to a file on
startup.  This is why when I move/rename the logfile I have to stop/start
postgresql to start appending to the empty file.

Would there be any interest in modifying postmaster to support native file
logging in addition to stderr and stdout output?  Are there any terrible
drawbacks that you could foresee?



Tue, 13 Apr 2004 13:23:38 -0500 (CDT)
"Thomas Swan" <tswan@idigx.com>
Re: rotatelogs integration in pg_ctl
Thomas Swan wrote:
> Would there be any interest in modifying postmaster to support native
> file logging in addition to stderr and stdout output?  Are there any
> terrible drawbacks that you could foresee?

We have about 8 years of mailing list archives describing them.

Tue, 13 Apr 2004 20:43:00 +0200
Peter Eisentraut <peter_e@gmx.net>
Re: rotatelogs integration in pg_ctl