Uploaded image for project: 'WildFly Core'
  1. WildFly Core
  2. WFCORE-5248

TCCL should be set to logging custom-handler module

XMLWordPrintable

    • Hide

      unzip -d $JBOSS_HOME reproducer-overlay.zip
      ./bin/standalone.sh

      Show
      unzip -d $JBOSS_HOME reproducer-overlay.zip ./bin/standalone.sh
    • Hide

      mkdir -p ./modules/org/jboss/logmanager/main/
      cp -R modules/system/layers/base/org/jboss/logmanager/main/* ./modules/org/jboss/logmanager/main/

      Add org.apache.log4j.asm dependency below:

      <module name="org.jboss.logmanager" xmlns="urn:jboss:module:1.8">
          <resources>
              <resource-root path="jboss-logmanager-2.1.17.Final-redhat-00001.jar"/>
          </resources>
      
          <dependencies>
              <!-- for java.beans -->
              <module name="java.desktop"/>
              <module name="java.logging"/>
              <module name="java.xml"/>
              <module name="javax.json.api"/>
              <module name="org.jboss.modules"/>
              <module name="org.wildfly.common"/>
              <module name="org.apache.log4j.asm" export="true"/>
          </dependencies>
      </module>
      

      Doing this means that any time you apply a CP you would have to update this, as it is overriding out module.

      Show
      mkdir -p ./modules/org/jboss/logmanager/main/ cp -R modules/system/layers/base/org/jboss/logmanager/main/* ./modules/org/jboss/logmanager/main/ Add org.apache.log4j.asm dependency below: <module name= "org.jboss.logmanager" xmlns= "urn:jboss:module:1.8" > <resources> <resource-root path= "jboss-logmanager-2.1.17.Final-redhat-00001.jar" /> </resources> <dependencies> <!-- for java.beans --> <module name= "java.desktop" /> <module name= "java.logging" /> <module name= "java.xml" /> <module name= "javax.json.api" /> <module name= "org.jboss.modules" /> <module name= "org.wildfly.common" /> <module name= "org.apache.log4j.asm" export= " true " /> </dependencies> </module> Doing this means that any time you apply a CP you would have to update this, as it is overriding out module.
    • Undefined

      When trying to specify the EvaluatorClass where the class exists in the module custom.evaluator , it fails with a ClassNotFound because the TCL is org.jboss.as.standalone instead of custom.evaluator module:

      Loader.getTCL return: ModuleClassLoader for Module "org.jboss.as.standalone" from local module loader @6adede5 (finder: local module finder @2d928643 (roots: /tmp/jboss-eap-7.3/modules,/tmp/jboss-eap-7.3/modules/system/layers/base))
      log4j:ERROR Could not instantiate class [org.apache.log4j.asm.INFOLevelEvaluator].
      java.lang.ClassNotFoundException: org.apache.log4j.asm.INFOLevelEvaluator from [Module "org.jboss.log4j.logmanager" version 1.2.0.Final-redhat-00001 from local module loader @6adede5 (finder: local module finder @2d928643 (roots: /tmp/jboss-eap-7.3/modules,/tmp/jboss-eap-7.3/modules/system/layers/base))]
              at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
              at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
              at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
              at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
              at java.lang.Class.forName0(Native Method)
              at java.lang.Class.forName(Class.java:264)
              at org.apache.log4j.helpers.Loader.loadClass(Loader.java:197)
              at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:326)
              at org.apache.log4j.net.SMTPAppender.setEvaluatorClass(SMTPAppender.java:549)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
              at org.jboss.logmanager.config.AbstractPropertyConfiguration$1.applyPostCreate(AbstractPropertyConfiguration.java:217)
              at org.jboss.logmanager.config.AbstractPropertyConfiguration$1.applyPostCreate(AbstractPropertyConfiguration.java:197)
              at org.jboss.logmanager.config.LogContextConfigurationImpl.doApplyPostCreate(LogContextConfigurationImpl.java:313)
              at org.jboss.logmanager.config.LogContextConfigurationImpl.doPrepare(LogContextConfigurationImpl.java:345)
              at org.jboss.logmanager.config.LogContextConfigurationImpl.prepare(LogContextConfigurationImpl.java:289)
              at org.jboss.logmanager.config.LogContextConfigurationImpl.commit(LogContextConfigurationImpl.java:298)
              at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:546)
              at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:97)
              at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:170)
              at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:132)
              at java.util.logging.LogManager$3.run(LogManager.java:399)
              at java.util.logging.LogManager$3.run(LogManager.java:396)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.util.logging.LogManager.readPrimordialConfiguration(LogManager.java:396)
              at java.util.logging.LogManager.access$800(LogManager.java:145)
              at java.util.logging.LogManager$2.run(LogManager.java:345)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.util.logging.LogManager.ensureLogManagerInitialized(LogManager.java:338)
              at java.util.logging.LogManager.getLogManager(LogManager.java:378)
              at org.jboss.modules.Main.main(Main.java:457)
      
                  <custom-handler name="email" class="org.apache.log4j.net.SMTPAppender" module="custom.evaluator">
                      <level name="INFO"/>
                      <filter-spec value="match(&quot;WFLYSRV0025&quot;)"/>
                      <formatter>
                          <named-formatter name="PATTERN"/>
                      </formatter>
                      <properties>
                          <property name="EvaluatorClass" value="org.apache.log4j.asm.INFOLevelEvaluator"/>
                      ...
                      </properties>
                  </custom-handler>
      

              jperkins-rhn James Perkins
              jperkins-rhn James Perkins
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: