Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

RE: How to modify the log4j log filename during runtime?

Bachler, Elisabeth (Elisabeth)

2007-01-19

Replies:

Thank you.
Elisabeth


-----Original Message-----
From: Noah White [mailto:emailnbw@(protected)]
Sent: jueves, 18 de enero de 2007 17:53
To: Tomcat Users List
Subject: Re: How to modify the log4j log filename during runtime?

First off this is a log4j question not a Tomcat question and should be
directed to the log4j list. You should begin by looking at the log4j
java docs. Log4j can be completely (re)configured pragmatically with its
APIs which is what you are trying to do. See
org.apache.log4j.PropertyConfigurator.

-Noah

On 1/18/07, Bachler, Elisabeth (Elisabeth) <ebachler@(protected)>
wrote:
>
>
> Hello,
> I have an application that uses log4j.
> In the application, I would like the user to choose the log file
> directory and the logfile name (using fileChooser).
> Now, how can I pass this information to log4j so it uses this filename

> as logfile?
>
> For the moment, I use as default: "C:\App\log.html"
>
> Here is the log4j.properties file I am using:
> ===================
> log4j.rootLogger=debug, R
>
> log4j.appender.R=org.apache.log4j.RollingFileAppender
> log4j.appender.R.File=C:\App\log.html
> log4j.appender.R.MaxFileSize=10MB
> log4j.appender.R.MaxBackupIndex=10
>
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
>
> log4j.appender.R.layout.ConversionPattern=%d{dd-MM-yyyy HH:mm:ss}
> %-5p (%C:%M:%
> L) - %m%n
> =====================
> Thanks
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.