You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Hei Chan <st...@yahoo.com> on 2008/04/17 20:50:44 UTC
How to log to a "dynamic folder"
Hi,
I am like to log4j.
I just wonder whether it is possible to log a different file in a different directory based on the hour, day, month, and year.
WhatI am trying to achieve is to log to a file at [some path]/[currentyear]/[current month]/[current day], and the file name will be thecurrent hour.
I have looked into DailyRollingFileAppender. Itallows me to append the time to the filename. But it is not exactlywhat I want.
Is there a way to configure log4j to log to a file based on the current year, month, day and hour?
Thanks in advance.
Cheers,
Hei
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
Re: How to log to a "dynamic folder"
Posted by "James A. N. Stauffer" <st...@gmail.com>.
This will achieve that:
http://stauffer.james.googlepages.com/DateFormatFileAppender.java
On Thu, Apr 17, 2008 at 1:50 PM, Hei Chan <st...@yahoo.com> wrote:
> Hi,
>
> I am like to log4j.
> I just wonder whether it is possible to log a different file in a different directory based on the hour, day, month, and year.
> WhatI am trying to achieve is to log to a file at [some path]/[currentyear]/[current month]/[current day], and the file name will be thecurrent hour.
> I have looked into DailyRollingFileAppender. Itallows me to append the time to the filename. But it is not exactlywhat I want.
> Is there a way to configure log4j to log to a file based on the current year, month, day and hour?
> Thanks in advance.
>
>
> Cheers,
> Hei
>
>
>
>
> ____________________________________________________________________________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
--
James A. N. Stauffer http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org