1 Reply Latest reply on Dec 14, 2017 4:04 AM by Christian Wansart

    How to use log4j2 in my ShrinkWrap container?

    Christian Wansart Newbie

      Hello,

       

      I use log4j2 for my project setup, but for some reason it does not work for my ShrinkWrap containers. I set it up like this:

       

      @RunWith(Arquillian.class)
      @RunAsClient
      public class MyIntegrationTest {
      
      
        private static final Logger LOG = LoggerFactory.getLogger(MyIntegrationTest.class);
      
      
        @Deployment
        public static Archive<?> createDeployment() {
          PomEquippedResolveStage pomFile = Maven.resolver().loadPomFromFile("pom.xml");
      
      
          WebArchive archive = ShrinkWrap.create(WebArchive.class)
              .addAsLibraries(pomFile.resolve("org.mockito:mockito-all").withTransitivity().asFile())
              .addAsLibraries(pomFile.resolve("org.slf4j:slf4j-api").withTransitivity().asFile())
              .addAsLibraries(pomFile.resolve("org.slf4j:jcl-over-slf4j").withTransitivity().asFile())
              .addAsLibraries(pomFile.resolve("org.apache.logging.log4j:log4j-slf4j-impl").withTransitivity().asFile())
              .addClasses(/* the required classes*/)
              .addAsResource("log4j2.xml")
              .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
      
      
          return archive;
        }
      
      
        // tests....
      }
      

       

      The log output of the Wildfly servers used by Arquillian is just the standard one. What do I do wrong?

       

      Regards

      Christian