2 Replies Latest reply on Feb 24, 2006 10:04 AM by Gerald Quintana

    Log4j config issues

    Nick de Graeve Newbie

      I have a log4j.xml that we modified. I created 2 appenders and some categories to add to the existing, default ones.
      I set the level for all packages below "com.fpc" to INFO.
      Now I want to enable debugging for the packages below "com.fpc.nokeos.component.controlpanel.question" so I added a category with level set to DEBUG.

      However, I don't see any debug messages at all.

      Any idea what I'm doing wrong?

      Extract of log4j.xml:

      <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
      
       <!-- NoKeos Log File -->
       <appender name="NOKEOS_FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
       <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
       <param name="File" value="${jboss.server.home.dir}/log/nokeos.log"/>
       <param name="Append" value="false"/>
       <param name="DatePattern" value="'.'yyyy-MM-dd"/>
       <layout class="org.apache.log4j.PatternLayout">
       <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
       </layout>
       </appender>
      
       <!-- NoKeos Log Console -->
       <appender name="NOKEOS_CONSOLE" class="org.apache.log4j.ConsoleAppender">
       <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
       <param name="Target" value="System.out"/>
       <param name="Threshold" value="DEBUG"/>
       <layout class="org.apache.log4j.PatternLayout">
       <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
       </layout>
       </appender>
      ...
       <!-- FPC Logger -->
       <category name="com.fpc" additivity="false"><!-- additivity to true didn't work either-->
       <priority value="INFO"/>
       <appender-ref ref="NOKEOS_FILE"/>
       <appender-ref ref="NOKEOS_CONSOLE"/>
       </category>
      
       <!-- Control Panel - Question plugin -->
       <category name="com.fpc.nokeos.component.controlpanel.question" additivity="false"> <!-- additivity to true didn't work either-->
       <priority value="DEBUG"/>
       <appender-ref ref="NOKEOS_FILE"/>
       <appender-ref ref="NOKEOS_CONSOLE"/>
       </category>
      ...


        • 1. Re: Log4j config issues
          jaikiran pai Master

          How are you instantiating the logger in your code? Are you using the JBoss Logger or the Log4j logger in your code. In the config file, is see that you have used jboss appender for NOKEOS_FILE and log4j appender for NOKEOS_CONSOLE:

          <appender name="NOKEOS_FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">


          <appender name="NOKEOS_CONSOLE" class="org.apache.log4j.ConsoleAppender">




          • 2. Re: Log4j config issues
            Gerald Quintana Newbie

            Here is what, I would personnally do:

            <appender name="NOKEOS_FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
             <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
             <param name="File" value="${jboss.server.home.dir}/log/nokeos.log"/>
             <param name="Append" value="false"/>
             <param name="DatePattern" value="'.'yyyy-MM-dd"/>
             <layout class="org.apache.log4j.PatternLayout">
             <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
             </layout>
            </appender>
            
            <category name="com.fpc" additivity="false">
             <priority value="INFO"/>
             <appender-ref ref="NOKEOS_FILE"/>
             <appender-ref ref="CONSOLE"/>
            </category>
            <category name="com.fpc.nokeos.component.controlpanel.question">
             <priority value="DEBUG"/>
            </category>
            


            One console seems enough because there is only one standard output
            By default additivity=true