Recently we have run into what appears to be lock contention with the default log4j package (1.2.14) that ships with JBoss 5.1.0.GA.
Our application has been running fine at various locations with the following basic configuration - JBoss 5.1.0.GA as a standalone configuration using JDK 1.6.0_45 (x64). We are using the default log4j configuration provided by JBoss. We modified the CONF\jboss-log4j.xml file to include our own application log files and this is fine unless we are at high load.
When we have a large number of concurrent requests we have detected blocking caused by the log4j libraries trying to look up the loggers in the Hierarchy class.
Thread: http-0.0.0.0-80-1 : priority:5, demon:true, threadId:121, threadState:BLOCKED
- waiting on <0xfe7b07> (a java.util.Hashtable)
All signs point to a synchronized Hashtable in the Hierarchy class in getLogger. Looking at the source code, it doesn't appear like this problem is fixed in the latest log4j 1.2 implementation (1.2.17).
Based on what I found, it looks like log4j2 has resolved this particular issue so I'd like to try and reconfigure JBoss 5.1.0 to use log4j2 across the board.
I modified our application so that is should work with log4j2 now (modified imports and changed calls from Logger.getLogger to LogManager.getLogger).
At this point, I'm trying to figure out how to modify JBoss to use log4j2. Here is what I have tried.
1. Copied the just released version of log4j2 jars (log4j-1.2-api.2.0.jar, log4j-api.2.0.jar, log4j-core-2.0.jar, log4j-web-2.0.jar) to the <Root>\lib directory.
2. Removed the following jars from the <Root>/lib directory
3. Added the following jars to <Root>/lib - (it was my understanding these jars were needed to support log4j2)
3. Created a new jboss-log4j.xml file (see attached)
jboss-log4j.xml 1.5 KB