Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

We are using JBoss application servers for our new web applications that use Apache log4j for logging. We are using JBoss for some months now and everything works out cool, the centralized config thing is really nice to work with.
Also, as you may know, you can deploy and undeploy applications and config files (like e.g. the mail-service.xml) during runtine, i.e. without restarting the server.

If you change the jboss-log4j.xml config file though, JBoss will not recognize changes unless you restart it. This is a bit annoying - it seems strange that the log4j config is the only config that you can not 'hot swap' while the server is running.

Are there easy ways to work around this, i.e. make it possible to 'hot swap' the log4j config file?

I have heard of a solution involving some servlet that, I suppose, will reload the new jboss-log4j.xml file. Has anyone done this before and could give some tips/instructions or a place where we could look that up?

Setup: We are using JBoss EAP 5.0 on Ubuntu 10.04 machines with the latest log4j .jar if that is of any importance.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Looks like JBoss actually does reload the log4j config automatically. But contrary to the other hot-pluggable files (like deploys or other server config) it does not happen instantaneously but at a set interval of 60 seconds.

I guess I was just to fast and impatient to notice this.

Here some more info on the matter:
http://blog.techstacks.com/2009/03/dynamically-updating-log-levels-in-jboss.html

share|improve this answer
1  
Note that you can adjust this interval. Under JBoss 4.2.2, it's in the conf/jboss-service.xml file. Look for the RefreshPeriod attribute of the org.jboss.logging.Log4jService MBean. –  Matt Solnit Oct 8 '10 at 16:43
    
Nice, thats handy! :) –  fgysin Oct 29 '10 at 14:18

We do this on an application-level basis via Java, a la http://logging.apache.org/log4j/1.2/faq.html#a3.6 ~LM

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.