1 Reply Latest reply on Jun 21, 2013 1:51 PM by James Perkins

    As 7.2 Log4j Logging

    Bill Rosenberg Newbie

      Logging seemed to work fine when i was using AS 7.1 with log4j libs and code, now when using 7.2, i do not see the expected logging using log4j.

       

      I follow the migration guide:

       

      Procedure 3.5. Configure JBoss Enterprise Application Platform 6 to use a log4 j.properties

      or log4 j.xml file

      1. 1. Create a jboss-deploym ent-structure.xm l with the following content:

      <jboss-deploym ent-structure>

      <deploym ent>

      <!-- Exclusions allow you to prevent the server from autom atically

      adding som e dependencies -->

      <exclusions>

      <m odule nam e="org.apache.log4j" />

      </exclusions>

      </deploym ent>

      </jboss-deploym ent-structure>

      1. 2. Place the jboss-deploym ent-structure.xm l file in either the MET A-INF/ directory or the

      WEB-INF/ directory if you are deploying a WAR, or in the MET A-INF/ directory if you are

      deploying an EAR.

      1. 3. Include the log4 j.properties or log4 j.xm l file in the lib/ directory in your deployment.
      2. 4. Start the JBoss Enterprise Application Platform 6 server with the following runtime argument to

      prevent a ClassCastException from appearing in the console when you deploy the application:

      -Dorg.jboss.as.logging.per-deploym ent=false

      1. 5. Deploy your application.

       

       

      And then i get an exception that log4j classes cannot be found, which i would expect if i exclude log4j from the deployment.

       

       

      12:41:29,192 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.subunit."LightSpeed.ear"."LightSpeedEJB.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."LightSpeed.ear"."LightSpeedEJB.jar".INSTALL: JBAS018733: Failed to process phase INSTALL of subdeployment "LightSpeedEJB.jar" of deployment "LightSpeed.ear"

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_21]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_21]

          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21]

      Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Priority

          at com.lightspeed.rdp.ejb.RateDynamicStatusBean.<clinit>(RateDynamicStatusBean.java:67)

          at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_21]

          at java.lang.Class.forName(Class.java:266) [rt.jar:1.7.0_21]

          at org.jboss.invocation.proxy.AbstractProxyFactory.afterClassLoad(AbstractProxyFactory.java:94)

          at org.jboss.invocation.proxy.AbstractClassFactory.defineClass(AbstractClassFactory.java:166)

          at org.jboss.invocation.proxy.AbstractProxyFactory.getCachedMethods(AbstractProxyFactory.java:145)

          at org.jboss.as.ejb3.component.stateless.StatelessComponentDescription$3.configure(StatelessComponentDescription.java:150)

          at org.jboss.as.ee.component.ComponentDescription$DefaultComponentConfigurator.configure(ComponentDescription.java:929)

          at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:80)

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

          ... 5 more

      Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Priority from [Module "deployment.LightSpeed.ear:main" from Service Module Loader]

          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:196) [jboss-modules.jar:1.2.0.Final-redhat-1]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:444) [jboss-modules.jar:1.2.0.Final-redhat-1]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:432) [jboss-modules.jar:1.2.0.Final-redhat-1]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:374) [jboss-modules.jar:1.2.0.Final-redhat-1]

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:119) [jboss-modules.jar:1.2.0.Final-redhat-1]

          ... 15 more