3 Replies Latest reply on Aug 22, 2006 10:39 AM by peterj

    Configuring log4j.xml for different logger levels on Console

      Hi,

      is it possible to configure log4j.xml to put out logging information on the DEBUG level on the console?

      I want to set different logger levels in the application using the command Logger.setLevel(Level.DEBUG) or Logger.setLevel(Level.INFO).

      Thanks,

      Stichel

        • 1. Re: Configuring log4j.xml for different logger levels on Con
          asack

          Have you read the log4j WIKI pages? :D

          • 2. Re: Configuring log4j.xml for different logger levels on Con

             

            "asack" wrote:
            Have you read the log4j WIKI pages? :D


            Thank you for the hint!

            The log4j WIKI pages have a topic "help with usage of logging levels". This advises you to put an entry like

            <category name="org.jboss.resource">
             <priority value="DEBUG"/>
            </category>


            into your log4j.xml to set the logger level to DEBUG.

            I made this changes to log4j.xml. But still JBoss suppresses DEBUG messages after a restart generated by my application. Do I use the wrong subsystem?

            If I am changing the value of Threshold in the default CONSOLE appender to DEBUG, JBoss gives out DEBUG messages to the console. But these are plenty of messages that probably will blockade JBoss.


            • 3. Re: Configuring log4j.xml for different logger levels on Con
              peterj

              To get the console to show DEBUG messages, edit the CONSOLE appender as follows (changed text in red):

              <appender name="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">
               <!-- The default pattern: Date Priority [Category] Message\n -->
               <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
               </layout>
               </appender>


              I noticed in the preview that using the color tag split the line, the lines "Threshold", DEBUG, and following line should be all on one line.