1 Reply Latest reply on Sep 10, 2013 2:44 PM by Wolf-Dieter Fink

    Jboss 6.1.0 and log4j -  logging slow

    Carolina Contiu Newbie

      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++)



                   if (logger.isInfoEnabled())


                           logger.info("This is a log");





      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">




               <level name="DEBUG"/>


                   <property name="file">${jboss.server.log.dir}/test.log</property>

                   <property name="append">true</property>

                   <property name="datePattern">'.'yyyy-MM-dd</property>




                   <pattern-formatter pattern="%d{HH:mm:ss,SSS}  %-5p [%C{1}] %m%n"/>





           <logger category="com.example" use-parent-handlers="false">

               <level name="INFO"/>


                   <handler-ref name="MyApp"/>




      I've also attached my jboss-logging.xml file.

      I would appreciate your help/ advice in troubleshooting this.