logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ITN \(Babu Easwaramoorthy\)" <Ba...@emiratesbank.com>
Subject RE: DailyRollingFileAppender question
Date Mon, 01 May 2006 05:33:29 GMT
Hi Curt, Jake,

Thanks for your solutions.
My problem is resolved. I was trying to create DailyRollingFileAppender
programmatically.

-Babu

-----Original Message-----
From: Jacob Kjome [mailto:hoju@visi.com] 
Sent: Monday, May 01, 2006 2:32 AM
To: Log4J Users List
Subject: Re: DailyRollingFileAppender question


I might be wrong, but I'll bet Babu wasn't considering 
programmatically creating the DailyRollingFileAppender.  Babu, I 
think what you are looking for is using a system property to define 
the file name for the appender.  For instance...

log4j.appender.myRollingAppender.File=/logs/${myRollingAppenderFileName}

If your configuration code, make sure you set the system property 
"myRollingAppenderFileName" before you call one of the configure() 
methods.  Or, just add something like 
"-DmyRollingAppenderFileName=someFileName.log" to the command line 
where you start your java program.  In the latter case, you can use 
Log4j auto-configuration rather than having to call configure()
manually.


Jake

At 09:28 AM 4/30/2006, you wrote:
 >You could either use the 3 parameter constructor or call
 >DailyRollingFileAppender.setFile (inheritied from FileAppender).
 >testMinuteRollover in http://svn.apache.org/repos/asf/logging/log4j/
 >trunk/tests/src/java/org/apache/log4j/DRFATestCase.java demonstrates
 >using the 3 parameter constructor.  If you use the 0 parameter
 >constructor and setFile, call activateOptions() before connecting the
 >appender to a logger.
 >
 >
 >On Apr 30, 2006, at 5:06 AM, ITN (Babu Easwaramoorthy) wrote:
 >
 >> Hi,
 >>
 >> I am using DailyRollingFileAppender.
 >> I do not want to specify the file name in the properties file.
 >> Instead I
 >> want to pass the file name when I instantiate the Logger in my
 >> programme.
 >> Is there any way to achieve this?
 >>
 >>
 >> Thanks in advance,
 >> Babu

 > 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org



 


DISCLAIMER:
This Electronic Mail and any attached information are confidential and may also be privileged.
It is intended only for the use of authorized persons. If you are not an addressee, or have
received the message in error, you are not authorized to read, copy, disseminate, distribute
or use the Electronic Mail or any attachment in any way. Please notify the sender by return
E-Mail or over the telephone and delete this e-mail

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message