You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Li Li <fa...@gmail.com> on 2011/09/28 10:36:32 UTC

A combination of DailyRollingFileAppender and RollingFileAppender

Hi all,
     I need split log files by file size like RollingFileAppender but I also
want separate logs by date like DailyRollingFileAppender. I searched the web
and can't find any good solution, so I write on myself. But I am not
familiar with log4j. So I wish there are some kind persons that will spend
some time to see whether my implementation is ok. I just copy codes
from RollingFileAppender and DailyRollingFileAppender and merge them.
     Thanks very much.

Re: A combination of DailyRollingFileAppender and RollingFileAppender

Posted by Li Li <fa...@gmail.com>.
   Thank you. But I must use log4j 1.2 now. is log4j 2.0 backward
compatible?
   Btw, I added another feature in my extension which can delete old files
when triggered in middle night.

On Wed, Sep 28, 2011 at 9:40 PM, Ralph Goers <ra...@dslextreme.com>wrote:

> Thanks, I will definitely take a look at it.  However, you might take a
> look at
> https://svn.apache.org/repos/asf/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/ which
> contains work towards (hopefully) Log4j 2.0. The RollingFileAppender
> supports both time and size based triggering. Although I have not completed
> the documentation, you can look in the tests for log4j-rolling3.xml that
> shows how to do both.
>
> Ralph
>
>
> On Sep 28, 2011, at 1:36 AM, Li Li wrote:
>
> Hi all,
>      I need split log files by file size like RollingFileAppender but I
> also want separate logs by date like DailyRollingFileAppender. I searched
> the web and can't find any good solution, so I write on myself. But I am not
> familiar with log4j. So I wish there are some kind persons that will spend
> some time to see whether my implementation is ok. I just copy codes
> from RollingFileAppender and DailyRollingFileAppender and merge them.
>      Thanks very much.
> <SizeBasedDailyRollingFileAppender.java>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>
>
>

Re: A combination of DailyRollingFileAppender and RollingFileAppender

Posted by Ralph Goers <ra...@dslextreme.com>.
Thanks, I will definitely take a look at it.  However, you might take a look at https://svn.apache.org/repos/asf/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/ which contains work towards (hopefully) Log4j 2.0. The RollingFileAppender supports both time and size based triggering. Although I have not completed the documentation, you can look in the tests for log4j-rolling3.xml that shows how to do both.

Ralph


On Sep 28, 2011, at 1:36 AM, Li Li wrote:

> Hi all,
>      I need split log files by file size like RollingFileAppender but I also want separate logs by date like DailyRollingFileAppender. I searched the web and can't find any good solution, so I write on myself. But I am not familiar with log4j. So I wish there are some kind persons that will spend some time to see whether my implementation is ok. I just copy codes from RollingFileAppender and DailyRollingFileAppender and merge them.
>      Thanks very much.
> <SizeBasedDailyRollingFileAppender.java>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org