Hi, Andy,

I never thought of Mike's first suggestion there before.  I like it.  I
have some more suggestions (although I think my 2nd is just the details
of Mike's 2nd):

Suggestion #1
====================
Put this in a JSP, and hit the JSP whenever you change your log
properties:

PropertyConfigurator.configure( "/path/to/log4j.properties" );


Suggestion #2
====================
Execute this somewhere near the beginning of your application's
initialization:

PropertyConfigurator.configureAndWatch( "/path/to/log4j.properties" );

http://logging.apache.org/log4j/docs/api/org/apache/log4j/PropertyConfigurator.html

On Fri, 2005-21-01 at 12:19 -0600, Mike Curwen wrote:
> There's two approaches.   
> 
> Configure tomcat to reload the context when class changes are made
> (log4j.properties being in the classes directory, will count as a class
> being changed, and then the whole context will reload).  We do this all the
> time.
> 
> Log4j can be used in a manner where config changes are discovered at
> run-time, though I've never tried it (and you should ask about in on the
> log4j-user list)
> 
> Mike Curwen
> 
> 
> > -----Original Message-----
> > From: Andy Kriger [mailto:[EMAIL PROTECTED] 
> > Sent: Friday, January 21, 2005 12:03 PM
> > To: tomcat-user@jakarta.apache.org
> > Subject: reload log4j.properties on-the-fly?
> > 
> > 
> > I am running Tomcat 5.5 with log4j logging (log4j.properties 
> > in common/classes).
> > 
> > Is it possible to make changes to the log4j properties and 
> > have the changes reloaded on-the-fly instead of having to 
> > restart Tomcat in order to pick up changes? This would be 
> > very useful for those times debug level logging or specific 
> > class logging is needed where generally that level of logging 
> > is not required.
> > 
> > thx
> > andy
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

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

Reply via email to