3 Replies Latest reply on Jun 13, 2012 7:04 AM by Christian Kölle

    Unable to disable JBoss logging subsystem

    Christian Kölle Newbie



      I have a problem with disabling the logging subsystem ind JBoss 7.1.1. The reason why we want to do this is a bug in the logging subsystem that causes performance problems:






      To do this I followed the descriptions in this article:




      Unfortunately this seems not to work completely. I get the following error messages during server start:


      08:42:13,787 ERROR [stderr] log4j:ERROR A "org.apache.log4j.xml.DOMConfigurator" object is not assignable to a "org.apache.log4j.spi.Configurator" variable.

      08:42:13,790 ERROR [stderr] log4j:ERROR The class "org.apache.log4j.spi.Configurator" was loaded by

      08:42:13,790 ERROR [stderr] log4j:ERROR [ModuleClassLoader for Module "deployment.myapp.ear:main" from Service Module Loader] whereas object of type

      08:42:13,796 ERROR [stderr] log4j:ERROR "org.apache.log4j.xml.DOMConfigurator" was loaded by [ModuleClassLoader for Module "org.apache.log4j:main" from local module loader @d233caf (roots: /opt/jboss7/modules)].

      08:42:13,796 ERROR [stderr] log4j:ERROR Could not instantiate configurator [org.apache.log4j.xml.DOMConfigurator].

      08:42:13,805 ERROR [stderr] log4j:WARN No appenders could be found for logger (myapp.MyClass).

      08:42:13,805 ERROR [stderr] log4j:WARN Please initialize the log4j system properly.


      And after that a lot of loader constraint violations:


      Caused by: java.lang.LinkageError: loader constraint violation: when resolving field "logger" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the referring class, myapp/MyClass, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for the field's resolved type, s/ModuleClassLoader, have different Class objects for that type


      I seems to me that the logging module is still used despite the configuration changes that should prevent the using of the subsystem.


      Any hints?




      PS: I have completely removed the subsystem in the standalone.xml and added a jboss-deployment-structure.xml in the META-INF directory of my ear with the following content:




              <!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->


                  <module name="org.apache.log4j" />




        • 1. Re: Unable to disable JBoss logging subsystem
          Tomaz Cerar Master



          you do not need to remove the whole subsystem to disable logging


          What you need is to propertly define excludes which should include org.jboss.logging and org.jboss.logmanager


          and especialy you need to properly define this exlusion for your submodules inside your ear as this is your main problem.

          the way you have it configured right now it will exclude org.apache.log4j from ear but not from any submodules (war,jars) you have.


          read https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7 for more info what can be done and how.





          • 2. Re: Unable to disable JBoss logging subsystem
            James Perkins Master

            Disabling the logging subsystem doesn't stop JBoss AS from using JBoss Log Manager. It will always use JBoss Log Manager even with the logging subsystem disabled. You should be able to just upgrade the log manager library to a new version with no problems though. In the moduels/org/jboss/logmanager/main directory just add the jboss-logging-1.3.1.Final.jar and modify the module.xml to use it.



            <?xml version="1.0" encoding="UTF-8"?> 
              ~ JBoss, Home of Professional Open Source.
              ~ Copyright 2010, Red Hat, Inc., and individual contributors
              ~ as indicated by the @author tags. See the copyright.txt file in the
              ~ distribution for a full listing of individual contributors.
              ~ This is free software; you can redistribute it and/or modify it
              ~ under the terms of the GNU Lesser General Public License as
              ~ published by the Free Software Foundation; either version 2.1 of
              ~ the License, or (at your option) any later version.
              ~ This software is distributed in the hope that it will be useful,
              ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
              ~ Lesser General Public License for more details.
              ~ You should have received a copy of the GNU Lesser General Public
              ~ License along with this software; if not, write to the Free
              ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
              ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
            <module xmlns="urn:jboss:module:1.1" name="org.jboss.logmanager">
                    <resource-root path="jboss-logmanager-1.3.1.Final.jar"/>
                    <!-- Insert resources here -->
            1 of 1 people found this helpful
            • 3. Re: Unable to disable JBoss logging subsystem
              Christian Kölle Newbie

              Hi James


              Thanks for the answer. After a lot of tries i already expected this .


              We decided to get the JBoss AS 7.1.2 from git and build it ourselves. That solved our performance problems and our application is now faster than on JBoss 5.1 .