6 Replies Latest reply on Mar 15, 2004 6:29 PM by ahardy66

    log4j.xml and output from a JBoss class

    ahardy66

      I can't configure log4j to output the logging from a JBoss class that I'm extending in my JAAS setup, and it's causing me major problems because I need the logging output to resolve a problem that's creating a brick wall in my path.

      The class is org.jboss.security.auth.spi.AbstractServerLoginModule and I really, really need to know what it is doing.

      I've tried several different category names to enable it, and in fact I currently have org.jboss set to TRACE for everything, and the logging is still not coming out, despite the fact that the rest of JBoss is logging virtually every executed line.

      I know it should be outputting several statements, because I can see the log statements in the source code of the methods I'm calling.

      This is what I've tried:

      <category name="org.jboss.security.auth.spi.AbstractServerLoginModule"
      also:
      org.jboss.auth.spi
      com.myclass.that.extends.it.LoginModule
      


        • 1. Re: log4j.xml and output from a JBoss class
          ahardy66

          In the latest push up the side of Mount Everest, err, I mean the JBoss learning curve, I have narrowed down the problem to the fact that the log statements are all TRACE priority.

          Does that give any kind JBoss guru an idea what I need to do?

          Strangely, setting the priority level in the log4j.xml to TRACE makes no difference.

          Could it have anything to do with the app I'm working on using java.util.logging ? Do they interfere?

          • 2. Re: log4j.xml and output from a JBoss class
            ahardy66

            In the latest blind stumblings in the regions beyond the JBossLog4j.pdf, I have found that I am incapable of turning on JBoss's TRACE logging level.

            Even with the XLevel class in the Priority setting.

            Even (despairing laughter coming from off-stage) after commenting out all my commons-logging and java.util.logging code.

            Is there a particular place on my computer which I should boot, or a special swear-word that I can use?

            • 3. Re: log4j.xml and output from a JBoss class

              Post your log4j.xml then you might get some help.

              Regards,
              Adrian

              • 4. Re: log4j.xml and output from a JBoss class
                ahardy66

                 

                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
                
                <!-- ===================================================================== -->
                <!-- -->
                <!-- Log4j Configuration -->
                <!-- -->
                <!-- ===================================================================== -->
                
                <!-- $Id: log4j.xml,v 1.13.2.8 2003/09/23 14:16:27 slaboure Exp $ -->
                
                <!--
                 | For more configuration infromation and examples see the Jakarta Log4j
                 | owebsite: http://jakarta.apache.org/log4j
                 -->
                
                <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
                
                 <!-- ================================= -->
                 <!-- Preserve messages in a local file -->
                 <!-- ================================= -->
                
                 <!-- A time/date based rolling appender -->
                 <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
                 <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
                 <param name="File" value="/log/server.log"/>
                 <param name="Append" value="false"/>
                
                 <!-- Rollover at midnight each day -->
                 <param name="DatePattern" value="'.'yyyy-MM-dd"/>
                
                 <!-- Rollover at the top of each hour
                 <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
                 -->
                
                 <layout class="org.apache.log4j.PatternLayout">
                 <!-- The default pattern: Date Priority [Category] Message\n -->
                 <param name="ConversionPattern" value="%-5p [%c] %m%n"/>
                
                 <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
                 <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
                 -->
                 </layout>
                 </appender>
                
                 <!-- ============================== -->
                 <!-- Append messages to the console -->
                 <!-- ============================== -->
                
                 <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="%-5p [%c] %m%n"/>
                 </layout>
                 </appender>
                
                 <appender name="JSR77" class="org.apache.log4j.FileAppender">
                 <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
                 <param name="Append" value="false"/>
                 <param name="File" value="/log/jsr77.log"/>
                 <layout class="org.apache.log4j.PatternLayout">
                 <param name="ConversionPattern" value="%-5p [%c] %m%n"/>
                 </layout>
                 </appender>
                
                 <!-- ================ -->
                 <!-- Limit categories -->
                 <!-- ================ -->
                
                 <!-- Limit JBoss categories -->
                 <category name="org.jboss">
                 <priority value="WARN" class="org.jboss.logging.XLevel"/>
                 </category>
                
                 <category name="org.jboss.system.server.Server">
                 <priority value="INFO" />
                 </category>
                 <category name="org.jboss.system">
                 <priority value="INFO" />
                 </category>
                 <category name="org.jboss.ha.framework.interfaces.HAPartition.lifecycle">
                 <priority value="INFO" />
                 </category>
                 <category name="org.jboss.deployment.MainDeployer">
                 <priority value="WARN" />
                 </category>
                 <category name="org.jboss.ejb.EJBDeployer">
                 <priority value="INFO" />
                 </category>
                 <category name="org.jboss.deployment">
                 <priority value="INFO" />
                 </category>
                
                 <category name="org.apache">
                 <priority value="WARN"/>
                 </category>
                 <category name="org.apache.catalina.startup">
                 <priority value="WARN"/>
                 </category>
                 <category name="org.apache.commons">
                 <priority value="WARN"/>
                 </category>
                
                 <category name="org.gargantus">
                 <priority value="TRACE"
                 class="org.jboss.logging.XLevel"/>
                 </category>
                
                 <category name="org.gargantus.realm.JBossLoginModule">
                 <priority value="TRACE"
                 class="org.jboss.logging.XLevel"/>
                 </category>
                
                 <category name="org.jboss.security">
                 <priority value="TRACE"
                 class="org.jboss.logging.XLevel"/>
                 </category>
                
                
                
                 <!-- ======================= -->
                 <!-- Setup the Root category -->
                 <!-- ======================= -->
                
                 <root>
                 <appender-ref ref="CONSOLE"/>
                 <!--appender-ref ref="FILE"/-->
                 </root>
                
                
                </log4j:configuration>
                
                


                There you go!


                • 5. Re: log4j.xml and output from a JBoss class
                  starksm64

                  You have commented out the FILE appender, and the CONSOLE appender has a threshold of INFO, so there will be no output to server.log at any threshold. Try checking your server.log timestamps next time.

                   <root>
                   <appender-ref ref="CONSOLE"/>
                   <appender-ref ref="FILE"/>
                   </root>
                  


                  • 6. Re: log4j.xml and output from a JBoss class
                    ahardy66

                    Guess I know too many logging frameworks too poorly.

                    Actually I deliberately got rid of the file appender to speed it up a bit.

                    Thanks for the diagnosis.