Re: logfile rotation

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: logfile rotation
Дата
Msg-id 200406190309.i5J391w16648@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: logfile rotation  (Andreas Pflug <pgadmin@pse-consulting.de>)
Ответы Re: logfile rotation  (Andreas Pflug <pgadmin@pse-consulting.de>)
Список pgsql-hackers
Actually, this is the current state of this issue.

---------------------------------------------------------------------------

Andreas Pflug wrote:
> Tom Lane wrote:
> 
> >Andreas Pflug <pgadmin@pse-consulting.de> writes:
> >  
> >
> >>>Answering my own question, the distribution of the current logfile 
> >>>name could be done trough a file handle.
> >>>      
> >>>
> >
> >  
> >
> >>would you mind commenting on my suggestion so I can continue on that topic?
> >>    
> >>
> >
> >There is no portable way to redistribute a file handle.
> >  
> >
> 
> Seems I didn't make clear enough what I mean.
> 
> I'd fopen a file handle  in the postmaster, and all subsequent processes 
> will inherit that handle just as they do for stderr; no redistribution 
> required.
> The log filename is written to that file when pg_logfile_rotate is called:
> fseek(fh, 0, SEEK_SET);
> fprintf(fh, "%s", newlogfilname);
> fflush();
> 
> and all subprocesses may retrieve the filename when required by
> 
> char buf[MAXPGPATH];
> fseek(fh, 0, SEEK_SET);
> fread(buf, 1, MAXPGPATH, fh);
> buf[MAXPGPATH-1]=0; // prevent buffer overflow
> logfile=fopen(buf, "a+");
> 
> Regards,
> Andreas
> 
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: More vacuum.c refactoring
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Why frequently updated tables are an issue