7 Replies Latest reply on Oct 22, 2006 12:19 AM by jaikiran pai

    Log4j error

    Edu Ninguno Newbie

      Hi, I'm a new user in jboss. My problem is when I run jboss obtain the following log:

      0:20:38,747 INFO [TomcatDeployer] deploy, ctxPath=/Cultura, warUrl=file:/usr/share/jboss-4.0.2/server/default/deploy/Cultura.war/
      10:20:41,191 INFO [STDOUT] log4j:ERROR A "org.jboss.logging.util.OnlyOnceErrorHandler" object is not assignable to a "org.apache.log4j.spi.ErrorHandler" variable.
      10:20:41,191 INFO [STDOUT] log4j:ERROR The class "org.apache.log4j.spi.ErrorHandler" was loaded by
      10:20:41,192 INFO [STDOUT] log4j:ERROR [WebappClassLoader
       delegate: false
       repositories:
       /WEB-INF/classes/
      ----------> Parent Classloader:
      java.net.FactoryURLClassLoader@1b2ede8
      ] whereas object of type
      10:20:41,192 INFO [STDOUT] log4j:ERROR "org.jboss.logging.util.OnlyOnceErrorHandler" was loaded by [org.jboss.system.server.NoAnnotationURLClassLoader@e102dc].
      10:20:41,446 INFO [STDOUT] log4j:ERROR Could not create an Appender. Reported error follows.
      10:20:41,446 INFO [STDOUT] java.lang.ClassCastException: org.jboss.logging.appender.DailyRollingFileAppender
      10:20:41,448 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:165)
      10:20:41,513 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:140)
      10:20:41,513 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:153)
      10:20:41,513 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:415)
      10:20:41,514 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:384)
      10:20:41,514 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:783)
      10:20:41,514 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:666)
      10:20:41,514 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:616)
      10:20:41,570 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:602)
      10:20:41,571 INFO [STDOUT] at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:460)
      10:20:41,571 INFO [STDOUT] at org.apache.log4j.LogManager.<clinit>(LogManager.java:113)
      10:20:41,571 INFO [STDOUT] at org.apache.log4j.Logger.getLogger(Logger.java:94)
      .....
      



      I have tried to modify the file jbossweb-tomcat55.sar/META-INF/jboss-service.xml
      as in other post is said but I obtain the same error or the followin:
      ERROR: invalid console appender config detected, console stream is loopingShutting down


      How can I fix it?
      Thanks in advance!




        • 1. Re: Log4j error
          jaikiran pai Master

          Are you packaging log4j.jar as part of your Cultura.war? If yes, then remove that jar from the war. The log4j jar is already present in the server's lib folder.

          • 2. Re: Log4j error
            Edu Ninguno Newbie

            I tried to remove log4j-1.2.9.jar from Cultura/WEB-INF/lib but it follows without working. The error the message continues appearing:

            ERROR: invalid console appender config detected, console stream is loopingShutting down


            • 3. Re: Log4j error
              jaikiran pai Master

              After this change, do you also see the other error that you had mentioned in your first post? Also, are you placing your log4j.properties or log4j.xml in your application(war file)? If yes remove this file and try adding the contents to the log4j.xml file present in %JBOSS_HOME%/server/default/conf folder(However, i dont think placing the xml or properties file in your application should have caused this error). Try it once. Also, please post the contents of the log4j.xml or log4j.properties that you are using.

              • 4. Re: Log4j error
                Edu Ninguno Newbie

                Hello again! I only see one error every time.The second error message appears when I make remove the files log4j.properties or log4j-1.2.9.jar from Cultura.

                The log4j.properties of Cultura is:

                # $Id: log4j.properties,v 1.1.1.1 2005/01/05 10:39:30 poth Exp $
                #
                # For the general syntax of property based configuration files see the
                # documenation of org.apache.log4j.PropertyConfigurator.
                
                # The root category uses the appender called deegree. Since no priority is
                # specified, the root category assumes the default priority for root
                # which is DEBUG in log4j. The root category is the only category that
                # has a default priority. All other categories need not be assigned a
                # priority in which case they inherit their priority from the
                # hierarchy.
                log.dir=${user.home}
                log4j.rootLogger=INFO, deegree, stdout
                #log4j.rootCategory=DEBUG
                ### set log levels - for more verbose logging change 'info' to 'debug' ###
                #log4j.rootLogger=DEBUG,stdout
                
                #
                # Console output Category
                #
                log4j.category.stdout=INFO,stdout
                #log4j.additivity.stdout=false
                
                #
                # Console Output
                #
                log4j.appender.stdout=org.apache.log4j.ConsoleAppender
                log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
                #log4j.appender.stdout.layout.ConversionPattern=[%d{dd MMM yyyy HH:mm:ss} %5p] - %m%n
                #log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
                log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %5p: %m%n
                
                ###############################################################################
                # deegree configuration
                ###############################################################################
                #
                # deegree goes into deegree Log
                #
                #log4j.category.org.deegree=DEBUG,deegree
                #log4j.additivity.org.deegree=false
                
                #
                # deegree logger to DEBUG
                #
                log4j.logger.org.deegree=INFO
                
                #
                # deegree Output
                #
                log4j.appender.deegree=org.apache.log4j.RollingFileAppender
                log4j.appender.deegree.File=${log.dir}/deegree.log
                log4j.appender.deegree.MaxFileSize=1000KB
                # Keep one backup file
                log4j.appender.deegree.MaxBackupIndex=1
                log4j.appender.deegree.layout=org.apache.log4j.PatternLayout
                #log4j.appender.deegree.layout.ConversionPattern=%p %t %c - %m%n
                log4j.appender.deegree.layout.ConversionPattern=%d %-5p [%c] %m%n


                The log4j.xml of jboss/server/default/conf is:

                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
                
                <!-- ===================================================================== -->
                <!-- -->
                <!-- Log4j Configuration -->
                <!-- -->
                <!-- ===================================================================== -->
                
                <!-- $Id: log4j.xml,v 1.26.2.2 2005/03/02 14:52:20 tdiesler 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="${jboss.server.home.dir}/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="%d %-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>
                
                 <!-- A size based file rolling appender
                 <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
                 <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
                 <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
                 <param name="Append" value="false"/>
                 <param name="MaxFileSize" value="500KB"/>
                 <param name="MaxBackupIndex" value="1"/>
                
                 <layout class="org.apache.log4j.PatternLayout">
                 <param name="ConversionPattern" value="%d %-5p [%c] %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="INFO"/>
                
                 <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>
                
                 <!-- ====================== -->
                 <!-- More Appender examples -->
                 <!-- ====================== -->
                
                 <!-- Buffer events and log them asynchronously
                 <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
                 <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
                 <appender-ref ref="FILE"/>
                 <appender-ref ref="CONSOLE"/>
                 <appender-ref ref="SMTP"/>
                 </appender>
                 -->
                
                 <!-- EMail events to an administrator
                 <appender name="SMTP" class="org.apache.log4j.net.SMTPAppender">
                 <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
                 <param name="Threshold" value="ERROR"/>
                 <param name="To" value="admin@myhost.domain.com"/>
                 <param name="From" value="nobody@myhost.domain.com"/>
                 <param name="Subject" value="JBoss Sever Errors"/>
                 <param name="SMTPHost" value="localhost"/>
                 <param name="BufferSize" value="10"/>
                 <layout class="org.apache.log4j.PatternLayout">
                 <param name="ConversionPattern" value="[%d{ABSOLUTE},%c{1}] %m%n"/>
                 </layout>
                 </appender>
                 -->
                
                 <!-- Syslog events
                 <appender name="SYSLOG" class="org.apache.log4j.net.SyslogAppender">
                 <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
                 <param name="Facility" value="LOCAL7"/>
                 <param name="FacilityPrinting" value="true"/>
                 <param name="SyslogHost" value="localhost"/>
                 </appender>
                 -->
                
                 <!-- Log events to JMS (requires a topic to be created)
                 <appender name="JMS" class="org.apache.log4j.net.JMSAppender">
                 <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
                 <param name="Threshold" value="ERROR"/>
                 <param name="TopicConnectionFactoryBindingName" value="java:/ConnectionFactory"/>
                 <param name="TopicBindingName" value="topic/MyErrorsTopic"/>
                 </appender>
                 -->
                
                 <!-- Log events through SNMP
                 <appender name="TRAP_LOG" class="org.apache.log4j.ext.SNMPTrapAppender">
                 <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
                 <param name="ImplementationClassName" value="org.apache.log4j.ext.JoeSNMPTrapSender"/>
                 <param name="ManagementHost" value="127.0.0.1"/>
                 <param name="ManagementHostTrapListenPort" value="162"/>
                 <param name="EnterpriseOID" value="1.3.6.1.4.1.24.0"/>
                 <param name="LocalIPAddress" value="127.0.0.1"/>
                 <param name="LocalTrapSendPort" value="161"/>
                 <param name="GenericTrapType" value="6"/>
                 <param name="SpecificTrapType" value="12345678"/>
                 <param name="CommunityString" value="public"/>
                 <param name="ForwardStackTraceWithTrap" value="true"/>
                 <param name="Threshold" value="DEBUG"/>
                 <param name="ApplicationTrapOID" value="1.3.6.1.4.1.24.12.10.22.64"/>
                 <layout class="org.apache.log4j.PatternLayout">
                 <param name="ConversionPattern" value="%d,%p,[%t],[%c],%m%n"/>
                 </layout>
                 </appender>
                 -->
                
                 <!-- ================ -->
                 <!-- Limit categories -->
                 <!-- ================ -->
                
                 <!-- Limit the org.apache category to INFO as its DEBUG is verbose -->
                 <category name="org.apache">
                 <priority value="INFO"/>
                 </category>
                
                 <!-- Limit the org.jgroups category to WARN as its INFO is verbose -->
                 <category name="org.jgroups">
                 <priority value="WARN"/>
                 </category>
                
                 <!-- Limit apache axis to INFO as its DEBUG is even more verbose -->
                 <category name="org.jboss.axis">
                 <priority value="INFO"/>
                 </category>
                
                 <!-- Limit JBoss categories
                 <category name="org.jboss">
                 <priority value="INFO"/>
                 </category>
                 -->
                
                 <!-- Limit the JSR77 categories -->
                 <category name="org.jboss.management">
                 <priority value="INFO"/>
                 </category>
                
                 <!-- Limit JBoss webservice category
                 <category name="org.jboss.webservice">
                 <priority value="DEBUG"/>
                 </category>
                 -->
                
                 <!-- Decrease the priority threshold for the org.jboss.varia category
                 <category name="org.jboss.varia">
                 <priority value="DEBUG"/>
                 </category>
                 -->
                
                 <!-- Show the evolution of the DataSource pool in the logs [inUse/Available/Max]
                 <category name="org.jboss.resource.connectionmanager.JBossManagedConnectionPool">
                 <priority value="TRACE" class="org.jboss.logging.XLevel"/>
                 </category>
                 -->
                
                 <!--
                 | An example of enabling the custom TRACE level priority that is used
                 | by the JBoss internals to diagnose low level details. This example
                 | turns on TRACE level msgs for the org.jboss.ejb.plugins package and its
                 | subpackages. This will produce A LOT of logging output.
                 <category name="org.jboss.system">
                 <priority value="TRACE" class="org.jboss.logging.XLevel"/>
                 </category>
                 <category name="org.jboss.ejb.plugins">
                 <priority value="TRACE" class="org.jboss.logging.XLevel"/>
                 </category>
                 -->
                
                 <!--
                 | Logs these events to SNMP:
                 - server starts/stops
                 - cluster evolution (node death/startup)
                 - When an EJB archive is deployed (and associated verified messages)
                 - When an EAR archive is deployed
                
                 <category name="org.jboss.system.server.Server">
                 <priority value="INFO" />
                 <appender-ref ref="TRAP_LOG"/>
                 </category>
                
                 <category name="org.jboss.ha.framework.interfaces.HAPartition.lifecycle">
                 <priority value="INFO" />
                 <appender-ref ref="TRAP_LOG"/>
                 </category>
                
                 <category name="org.jboss.deployment.MainDeployer">
                 <priority value="ERROR" />
                 <appender-ref ref="TRAP_LOG"/>
                 </category>
                
                 <category name="org.jboss.ejb.EJBDeployer">
                 <priority value="INFO" />
                 <appender-ref ref="TRAP_LOG"/>
                 </category>
                
                 <category name="org.jboss.deployment.EARDeployer">
                 <priority value="INFO" />
                 <appender-ref ref="TRAP_LOG"/>
                 </category>
                
                
                 -->
                
                
                 <!-- ======================= -->
                 <!-- Setup the Root category -->
                 <!-- ======================= -->
                
                 <root>
                 <appender-ref ref="CONSOLE"/>
                 <appender-ref ref="FILE"/>
                 </root>
                
                 <!-- Clustering logging -->
                 <!-- Uncomment the following to redirect the org.jgroups and
                 org.jboss.ha categories to a cluster.log file.
                
                 <appender name="CLUSTER" class="org.jboss.logging.appender.RollingFileAppender">
                 <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
                 <param name="File" value="${jboss.server.home.dir}/log/cluster.log"/>
                 <param name="Append" value="false"/>
                 <param name="MaxFileSize" value="500KB"/>
                 <param name="MaxBackupIndex" value="1"/>
                
                 <layout class="org.apache.log4j.PatternLayout">
                 <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
                 </layout>
                 </appender>
                 <category name="org.jgroups">
                 <priority value="DEBUG" />
                 <appender-ref ref="CLUSTER"/>
                 </category>
                 <category name="org.jboss.ha">
                 <priority value="DEBUG" />
                 <appender-ref ref="CLUSTER"/>
                 </category>
                 -->
                
                </log4j:configuration>




                • 5. Re: Log4j error
                  jaikiran pai Master

                  You will have to add the contents of your log4j.properties to the log4j.xml present in the %JBOSS_HOME%/server/default/conf folder and remove the log4j.properties from your application. However, if you want to use your own log4j.properties file then, you will have to follow the steps mentioned here:

                  http://wiki.jboss.org/wiki/Wiki.jsp?page=ClassLoaderScopingProperties

                  • 6. Re: Log4j error
                    Edu Ninguno Newbie

                    Hello again! I have followed the steps of the URL that you gave me. I modified conf/jboss-service.xml, renamed conf/log4j.xml to jboss-log4j.xml, dropped log4j from myapp.war/WEB-INF/lib/, I created an jboss-web.xml file because myapp didn't contain it.
                    Is the following one:

                    <?xml version='1.0' encoding='UTF-8' ?>
                    
                    <!DOCTYPE jboss-web
                     PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN"
                     "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd">
                    
                    <jboss-web>
                     <class-loading java2ClassLoadingCompliance="false">
                     <loader-repository>
                     myapp:loader=myapp.war
                     <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
                     </loader-repository>
                     </class-loading>
                    </jboss-web>
                    


                    I proved to create a new log4j.properties like this:
                    # Debug log4j
                    log4j.debug=true
                    
                    log4j.rootLogger=debug, myapp
                    
                    log4j.appender.myapp=org.apache.log4j.FileAppender
                    log4j.appender.myapp.layout=org.apache.log4j.HTMLLayout
                    log4j.appender.myapp.layout.LocationInfo=true
                    log4j.appender.myapp.layout.Title='All' Log
                    log4j.appender.myapp.File=${jboss.server.home.dir}/deploy/myapp.war/WEB-INF/logs/myapp.html
                    log4j.appender.myapp.ImmediateFlush=true
                    log4j.appender.myapp.Append=false

                    and I also proved to leave the original log4j.properties file, but neither tests work.
                    In the first test jboss seems to stop when it deploy myapp, and in the second I obtain:
                    ERROR: invalid console appender config detected, console stream is loopingShutting down


                    What can I do? I don't proved to convert log4j.properties to log4j.xml because I don't know how do it. If you could give some track me of like making it or URL where I could find it, I would thank you a lot.

                    Thanks in advance!

                    • 7. Re: Log4j error
                      jaikiran pai Master

                      emontana,

                      Let me give it a try on my JBoss setup, using the log4j.properties that you have posted. However, since i will be out of office for the entire next week, i will be able to do this only once i return. Hopefully, by then someone else might be able to help you out.