Skip to end of metadata
Go to start of metadata

Overview

  1. This example is intended for those using Log4J directly. If you are already using SLF4J, (and you should be) you can simply use SLF4JBridgeHandler which is part of the jul-to-slf4j module.
  2. JBoss 5.x has a built in JUL redirect feature. This is not needed if you are using JBoss 5.x or higher.

Here's a little Handler I made that routes java.util.logging messsages to Log4J. These are all available here:

This very nicely solves the Facelets 'loadImplicit' error issue as well as giving you the flexibility to enable more detailed logging for the JSF reference implementation.

The java.util.logging Handler Class

JuliToLog4jHandler.java

JMX MBean Wrapper

Lifecycle.java

JuliToLog4jServiceMBean.java

JuliToLog4jService.java

Adding it to JBoss AS

Once you have the classes in the classpath, just add the following to conf/jboss-service.xml right after the Log4JService declaration:

NOTE: This is not needed in JBoss 5.x, it already has this feature.

See Also

  1. Jul 12, 2011

    Anonymous

    indeed logging is very important but at the same time using correct logging level is more important otherwise excessive logging will  reduce the application performance by the way here is  my favorite java logging tips  you may find interesting

    1. Jul 12, 2011

      That link doesn't work because it has a trailing double quote. Here is the correct link:

      http://javarevisited.blogspot.com/2011/05/top-10-tips-on-logging-in-java.html

  2. Aug 08, 2011

    Anonymous

    I created the following code to transfer all the log4j loger configuration to JUL logger configurations. This should speed things up a bit since there are no unnecesary log messages created in JUL which are then dropped in Log4J:

    1. Aug 09, 2011

      Neat. Yeah, that would make things more streamlined.