3

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.

2 Answers 2

2

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

2
  • 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. Oct 8, 2010 at 16:43
  • Nice, thats handy! :)
    – fgysin
    Oct 29, 2010 at 14:18
1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .