if you only want that files end with a certain file ending there is the
following "hack" :

log4j.appender.DAILY=org.apache.log4j.DailyRollingFileAppender
log4j.appender.DAILY.File=log/myApp.log
log4j.appender.DAILY.DatePattern='.'yyyy-MM-dd'.log'

resulting in the files:
"myApp.log" for the actual day 
"myApp.log.2006.09.30.log" for previous days

this has the atvantage that you do not need any non-standard appenders

cheers
patrick


James Stauffer wrote:
> 
> I have written an appender that can do that.
> http://stauffer.james.googlepages.com/DateFormatFileAppender.java
> 
> On 9/18/06, kingwell <[EMAIL PROTECTED]> wrote:
>> Hi all,
>> I want to define the log file name pattern like yyyymmdd-mylog.log, how
>> to
>> do so using log4j?
>> As the DailyRollingFileAppender is just append the yyymmdd pattern to the
>> end of the file name, something like mylog.log.yyyymmdd. Do I need to
>> write
>> my own appender class, or can anyone provide some helpful util class?
>>
>>
>>
>> Thanks for help!
>>
>>
>>
>>
>>
> 
> 
> -- 
> James Stauffer        http://www.geocities.com/stauffer_james/
> Are you good? Take the test at http://www.livingwaters.com/good/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/how-to-define-my-own-log-file-name-tf2291211.html#a6616382
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to