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 "ITN (Babu Easwaramoorthy)" <Ba...@emiratesbank.com> on 2006/04/30 12:06:27 UTC
DailyRollingFileAppender question
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
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
Re: DailyRollingFileAppender question
Posted by Jacob Kjome <ho...@visi.com>.
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
Re: DailyRollingFileAppender question
Posted by Curt Arnold <ca...@apache.org>.
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
>
>
>
> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org