Log4j

Logging has a profound effect on performance. Changing the logging level to 
TRACE can bring the JBossAS to a crawl. Changing it to ERROR (or WARN) can 
speed things up dramatically. \

    * By default, JBoss logs both to the console and server.log and by default 
it uses level "INFO".
    * Consider not logging to System.out (you may still want to redirect it to 
catch JVM errors)
    * Consider changing the log level to ERROR. Remember that JBoss watches its 
log4j config file for changes and you can always change configuration at 
runtime.
    * Add a category filter for your Java class hierarchy.

To turn off console logging:

    * Edit server/slim/conf/log4j.xml
    * Change the following XML fragment:

 
 
  <appender-ref ref=CONSOLE"/> 
  <appender-ref ref="FILE"/> 
 

make it read

 
 
  <appender-ref ref="FILE"/> 
 

    * You can then remove this fragment:

 
 
   
   
   
   
    <!-- The default pattern: Date Priority [Category] Message\n --> 
     
   
 

To change the log level:

    * Edit server/slim/conf/log4j.xml
    * Remove/comment these XML fragments:

 
 
   
 

<!-- Limit org.jgroups category to INFO --> 
 
   
 

    * Change the root category by changing this XML fragment:

 
 
  <appender-ref ref="CONSOLE"/> <!-- you may have removed this earlier --> 
  <appender-ref ref="FILE"/> 
 

to look like this

 
 
   
  <appender-ref ref="CONSOLE"/> <!-- you may have removed this earlier --> 
  <appender-ref ref="FILE"/> 
 

And finally, probably the most important thing in log4j, make sure you limit 
the logging level on your own class hierarchy. This assumes that you are using 
log4j as it was intended and not writing everything to System.out. This will 
significantly reduce the overhead of log4j and allow you to fully enjoy the 
benefits of calls like if (log.isDebugEnabled()).... If you don't do this then 
all the logging in your code will get formatted and passed to the appender, and 
the threshold on the appender will weed out the log messages. This can generate 
a significant amount of garbage. Assuming your java package starts with "a.b", 
add something like this to log4j.xml:

 
<!-- Limit a.b category to INFO --> 
 
 
 

This can be added in the same area where you find the category filters for 
org.apache and org.jboss (see above). 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949840#3949840

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949840


_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to