1 Reply Latest reply on Jul 14, 2014 7:06 PM by jamezp

    JBoss log4j is ignoring the logger levels on my log4jdbc loggers.

    pictor

      I have been using log4j on a per-deployment basis, with each app having it's own log4j.jar and log4j.xml. The log4j jar is set as an exclusion in the jboss-deployment-structure, and the jar is in the lib. However we have run afoul of the memory leak issue.


      https://bugzilla.redhat.com/show_bug.cgi?id=1038305


      I suppose I could wait for EAP 6.3...but we're on 6.1 right now.


      I have been led to understand that if I switch to the JBoss log4j, the memory leak issue would go away.  So I remove the exclusion, I remove the jar, and sure enough jboss logmanager takes over the logging. However as soon as I do this, my log4jdbc loggers go haywire. They start logging everything under the sun. What is happening is that I have loggers for the various log4jdbc loggers. By default, they are set to fatal level (see log4j.xml snippet below). Before the change, when I intercepted the relevant loggers in the debuggers, I could see sure enough that their level was set to FATAL. With the new change, the loggers have a level of null, which interprets to ALL, and EVERYTHING is logged.  I have had very little success divining the cause. I know it's finding the log4j.xml file, since the correct log file is getting used, and it's define here in the appender. So the xml is being parsed, but the logger level is getting ignored.


      log4j.xml


      <log4j:configuration debug="false">

          <appender name="myAppender" class="org.apache.log4j.DailyRollingFileAppender">

              <param name="File" value="/tmp/output.log"/>

              <param name="DatePattern" value="'.'yyyy-MM-dd"/>

              <param name="append" value="true"/>

              <param name="encoding" value="UTF-8"/>

              <layout class="org.apache.log4j.PatternLayout">

                  <param name="ConversionPattern" value="%d{HH:mm:ss.SSS} [%p] [%t] %m%n"/>

              </layout>

          </appender>

       

          <logger name="jdbc.connection" additivity="false">

              <level value="fatal"/>

              <appender-ref ref="myAppender"/>

          </logger>

      ...etc...

      <root>

              <level value="info"/>

              <appender-ref ref="myAppender"/>

          </root>