5 Replies Latest reply on Feb 23, 2005 12:36 PM by scott sadlo

    Implementing EAR based logging

    Thomas Krug Newbie

      I need to use an own logging for one of my apps. The EAR includes the log4j.jar and on WAR level the log4j.properties and commons-logging-properties with an own LogFactory.
      Using Tomcat on it's own everything works fine. Using JBoss (3.2.5) all logging goes to the JBoss log.

      I followed the instructions in the WIKI for classloading and Logging (renaming log4j.xml), still JBoss reveives all events.

      Did anyone implement "EAR based" logging successfully?

      Regards

      Thomas

        • 1. Re: Implementing EAR based logging
          Scott Stark Master

          Which of the various techniques described in the loggins page have you tried? This page has been updated since you originally posted.

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

          • 2. Re: Implementing EAR based logging
            Thomas Krug Newbie

            I checked classload scoping with 3.2.5 and 4.0 (default config). I also deployed the log4j.war from the example, the log data get logged in the server.log....... Same with JBoss 4.0

            What happens is that Jboss seems to try some reflections and throws MethodNotFound Exceptions and ReflectionExceptions on the BaseModelMBean of org.apache.commons.modeler.

            I have the Apache Commons and the log4j Jar's in my classpath (WEB-INF\LIB, an own logFactory with commons-logging.properties

            org.apache.commons.logging.LogFactory=de.sparkasseninformatik.common.logger.SiLogFactory
            


            and the log4j.properties in WEB-INF\Classes.

            I read in another post about a bug in 3.2.5 where the classpath is at servlet init time not available, which you stated is fixed in 3.2.6RC1. Could that be the problem?

            • 3. Re: Implementing EAR based logging
              Thomas Krug Newbie

              I packaged the log4j.war in an ear and got some more information

              2004-09-27 09:52:45,598 WARN
              [org.jboss.deployment.DeploymentInfo] Only the root deployment can
              set the loader repository, ignoring config=LoaderRepositoryConfig
              (repositoryName: log4j.test:loader=log4j.war, repositoryClassName:
              org.jboss.mx.loading.HeirarchicalLoaderRepository3,
              configParserClassName:
              org.jboss.mx.loading.HeirarchicalLoaderRepository3ConfigParser,
              repositoryConfig: java2ParentDelegation=false)
              
              


              Thomas

              • 4. Re: Implementing EAR based logging
                Emanuel Elhardt Newbie

                Hi,
                did you get any solution for your poblem? Since I have the same problem, I would be glad to know how you solved it.

                I am trying to set up logging for different applications. Meaning, I want for some applications that they log in a seperate loggingfile then the main server.log.

                Thank you very much for sharing your experience.

                regards

                Emanuel Elhardt
                elhardt(a)visionet.de

                • 5. Re: Implementing EAR based logging
                  scott sadlo Newbie

                  tkrug0210's code listing has points to the answer. If you read through this
                  http://www.jboss.org/wiki/Wiki.jsp?page=ClassLoadingConfiguration you should find that:

                  Only the top level deployment may specify scoping. If you have an ear, containing other modules, only scoping specified in the ear META-INF/jboss-app.xml has any effect. This applies for any other deployment sitting in the deploy directory which contains other types of deployments. If a sar contains other deployments, only the sar META-INF/jboss-service.xml scoping has any effect.

                  This works for me BUT i have to remove common-logging.jar from my ear. Does anyone know of a way to get around custom tailoring the list of jars in an ear just to satisfy the JBoss CL?