You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by Viktor Radnai <vi...@gmail.com> on 2012/01/13 14:06:12 UTC

[PATCH] new appender: LoggerAppenderDailyRollingFile

Hi all,

This is my first post to this list. I have created a
LoggerAppenderDailyRollingFile appender for a project that I'm working
on. This is needed there because I have a long-lived PHP process that
would otherwise not rotate the logfile. It is also possible to rotate
log files once every hour or even minute if needed, by setting the
'rotate' property appropriately. This is illustrated in the
configuration example below:

log4php.appender.logfile = LoggerAppenderDailyRollingFile
log4php.appender.logfile.layout = LoggerLayoutTTCC
log4php.appender.logfile.rotate = i
log4php.appender.logfile.datePattern = Ymd-Hi

The attached patch file is against 2.2.0/src/main/php. Would you
consider this appender useful for the general public and include in
the project?

Cheers,
Vik

Re: [PATCH] new appender: LoggerAppenderDailyRollingFile

Posted by Viktor Radnai <vi...@gmail.com>.
Hi Christian,

You mean functionally or in the class hierarchy?

Functionally this fixes an issue for long running PHP requests, but not 
everyone will like the rollover -- on a web app you might prefer log 
entries from a single request ending up in the same file even if it 
begins processing at 23:59:55 and finish at 0:00:05. But for something 
that runs continually for days (eg. a daemon), this appender makes more 
sense.

Regarding the class hierarchy this class is kind of a cross between 
LoggerAppenderDailyFile and LoggerAppenderRollingFile, and I've 
implemented it as a 'fork' of the former. Functionally it can be 
considered an extension though.

I originally wrote this patch about a year ago, and just ported it to 
2.2.0 now, so I can't remember the exact reasoning. At the time it 
seemed easier to do it this way than making 
LoggerAppenderDailyRollingFile extend the LoggerAppenderDailyFile class. 
But I was not necessarily right about that.

Cheers,
Vik


On 01/13/2012 02:10 PM, Christian Grobmeier wrote:
> Hello Viktor,
>
> how does it compare to this appender?
> http://logging.apache.org/log4php/docs/appenders/daily-file.html
> Is it an extension?
>
> Thanks for your work!
> Cheers
>
> On Fri, Jan 13, 2012 at 2:06 PM, Viktor Radnai<vi...@gmail.com>  wrote:
>> Hi all,
>>
>> This is my first post to this list. I have created a
>> LoggerAppenderDailyRollingFile appender for a project that I'm working
>> on. This is needed there because I have a long-lived PHP process that
>> would otherwise not rotate the logfile. It is also possible to rotate
>> log files once every hour or even minute if needed, by setting the
>> 'rotate' property appropriately. This is illustrated in the
>> configuration example below:
>>
>> log4php.appender.logfile = LoggerAppenderDailyRollingFile
>> log4php.appender.logfile.layout = LoggerLayoutTTCC
>> log4php.appender.logfile.rotate = i
>> log4php.appender.logfile.datePattern = Ymd-Hi
>>
>> The attached patch file is against 2.2.0/src/main/php. Would you
>> consider this appender useful for the general public and include in
>> the project?
>>
>> Cheers,
>> Vik
>
>
>

Re: [PATCH] new appender: LoggerAppenderDailyRollingFile

Posted by Ivan Habunek <iv...@gmail.com>.
Well we do have an issue for that exact problem. :)
https://issues.apache.org/jira/browse/LOG4PHP-120

I will have a look at the patch when I get a chance.

Regards,
Ivan

On 13 January 2012 14:10, Christian Grobmeier <gr...@gmail.com> wrote:

> Hello Viktor,
>
> how does it compare to this appender?
> http://logging.apache.org/log4php/docs/appenders/daily-file.html
> Is it an extension?
>
> Thanks for your work!
> Cheers
>
> On Fri, Jan 13, 2012 at 2:06 PM, Viktor Radnai <vi...@gmail.com>
> wrote:
> > Hi all,
> >
> > This is my first post to this list. I have created a
> > LoggerAppenderDailyRollingFile appender for a project that I'm working
> > on. This is needed there because I have a long-lived PHP process that
> > would otherwise not rotate the logfile. It is also possible to rotate
> > log files once every hour or even minute if needed, by setting the
> > 'rotate' property appropriately. This is illustrated in the
> > configuration example below:
> >
> > log4php.appender.logfile = LoggerAppenderDailyRollingFile
> > log4php.appender.logfile.layout = LoggerLayoutTTCC
> > log4php.appender.logfile.rotate = i
> > log4php.appender.logfile.datePattern = Ymd-Hi
> >
> > The attached patch file is against 2.2.0/src/main/php. Would you
> > consider this appender useful for the general public and include in
> > the project?
> >
> > Cheers,
> > Vik
>
>
>
> --
> http://www.grobmeier.de
> https://www.timeandbill.de
>

Re: [PATCH] new appender: LoggerAppenderDailyRollingFile

Posted by Christian Grobmeier <gr...@gmail.com>.
Hello Viktor,

how does it compare to this appender?
http://logging.apache.org/log4php/docs/appenders/daily-file.html
Is it an extension?

Thanks for your work!
Cheers

On Fri, Jan 13, 2012 at 2:06 PM, Viktor Radnai <vi...@gmail.com> wrote:
> Hi all,
>
> This is my first post to this list. I have created a
> LoggerAppenderDailyRollingFile appender for a project that I'm working
> on. This is needed there because I have a long-lived PHP process that
> would otherwise not rotate the logfile. It is also possible to rotate
> log files once every hour or even minute if needed, by setting the
> 'rotate' property appropriately. This is illustrated in the
> configuration example below:
>
> log4php.appender.logfile = LoggerAppenderDailyRollingFile
> log4php.appender.logfile.layout = LoggerLayoutTTCC
> log4php.appender.logfile.rotate = i
> log4php.appender.logfile.datePattern = Ymd-Hi
>
> The attached patch file is against 2.2.0/src/main/php. Would you
> consider this appender useful for the general public and include in
> the project?
>
> Cheers,
> Vik



-- 
http://www.grobmeier.de
https://www.timeandbill.de