I am using Jboss 6.1.0 and log4j 1.2.16.
I run a simple test : logging the same line for 20k times.
ie :
Long took=0l;
for(int j=0;j<20000;j++)
{
time=System.currentTimeMillis();
if (logger.isInfoEnabled())
{
logger.info("This is a log");
}
took+=(System.currentTimeMillis()-time);
}
It takes around 15 sec for the logging part to execute.
I've done the same test against jboss 4.0.5 and log4j 1.2.8 and it runs way faster 0.155 sec (100 times faster).
This is my log4j-appender:
<log4j-appender name="MyApp" class="org.apache.log4j.DailyRollingFileAppender">
<error-manager>
<only-once/>
</error-manager>
<level name="DEBUG"/>
<properties>
<property name="file">${jboss.server.log.dir}/test.log</property>
<property name="append">true</property>
<property name="datePattern">'.'yyyy-MM-dd</property>
/properties>
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%C{1}] %m%n"/>
</formatter>
</log4j-appender>
<logger category="com.example" use-parent-handlers="false">
<level name="INFO"/>
<handlers>
<handler-ref name="MyApp"/>
</handlers>
</logger>
I've also attached my jboss-logging.xml file.
I would appreciate your help/ advice in troubleshooting this.
As the JBoss 6.1.0 is a old version I would recommend to use AS or EAP6.1.
If you prefer to stay with the old implementation I would use JBoss5