4 Replies Latest reply on Aug 17, 2015 3:39 AM by Sathish Kumar

    Own log4j.xml on a Wildfly 8.1.0.Final doesn't work

    Anton Gordiichuk Newbie

      Hi guys, could you help me,


      We've migrated our app from Tomcat to the last Wildfly 8.1.0.Final. After migration we've met some problem with our log4j. When application is working I see only INFO level log in the console, even when DEBUG level is enabled in our own log config. Looks like Wildfly doesn't use our config and logging all through the own logging system. I've read logging documentation but it didn't help. log4j.xml in the classpath. When I open our war file, I see that log4j in the correct place, WEB-INF/classes directory.


      Maybe we should make additional actions to enable own logger? We don't want make our app server dependent even if this is only logs.


      Our log4j.xml


      <?xml version="1.0" encoding="UTF-8" ?>

      <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

      <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

          <appender name="console" class="org.apache.log4j.ConsoleAppender">

              <param name="Target" value="System.out"/>

              <layout class="org.apache.log4j.PatternLayout">

                  <param name="ConversionPattern" value="%-5p %c{1} - %m%n"/>




              <priority value ="ALL" />

              <appender-ref ref="console" />






      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

               xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"









              <!-- Spring Web MVC framework -->







              <!-- Spring ORM -->







              <!-- JSTL -->








              <!-- Apache Tiles -->







              <!-- Apache Utils -->







              <!-- Servlet API -->







              <!-- Log4j -->












      Log usage


      private static Logger log = Logger.getLogger("myLogger");

      log.debug("debug message"); // doesn't works

      log.info("info message"); // works

        • 1. Re: Own log4j.xml on a Wildfly 8.1.0.Final doesn't work
          Robert Panzer Newbie



          JBoss brings its own Log4J implementation as a module.

          Modules are always loaded first, so you are probably using the log4j implementation of JBoss that does not see the log4.xml in your application.

          If you have an own impl in your application you could try to exclude the dependency on log4j by adding this jboss-deployment-structure.xml to the WEB-INF folder of your war file.

          (I assume that you are directly deploying a war file and not an ear, right?)


          <?xml version="1.0" encoding="UTF-8"?>




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





          Kind regards,


          • 2. Re: Own log4j.xml on a Wildfly 8.1.0.Final doesn't work
            Anton Gordiichuk Newbie

            I looking for decision which don't need exclude server log4j impl. I want use it with my own log config. Documentation said:

            Per-deployment Logging

            Per-deployment logging allows you to add a logging configuration file to your deployment and have the logging for that deployment configured according to the configuration file. In an EAR the configuration should be in the META-INF directory. In a WAR or JAR deployment the configuration file can be in either theMETA-INF or WEB-INF directories.

            The following configuration files are allowed:

            • logging.properties
            • jboss-logging.properties
            • log4j.properties
            • log4j.xml
            • jboss-log4j.xml


            According to this I should only add my own config to the specified dir, but unfortunately it doesn't work for me.

            • 3. Re: Own log4j.xml on a Wildfly 8.1.0.Final doesn't work
              Anton Gordiichuk Newbie

              Maybe it will be useful somebody to know. After some investigation we find out that in case when own log4j.xml uses, Wildfly uses our own configuration as outlined in a documentation, but with some restriction. In case when we declare file appender it works fine as we expected. But in case using console appenders, our console logs writes to the file, defined for file appender, and marked as [stdout]. So you don't find any own logs in the real console even if you use console appender. Server overrides Target System.out to org.jboss.stdio.NullOutputStream.

              • 4. Re: Own log4j.xml on a Wildfly 8.1.0.Final doesn't work
                Sathish Kumar Newbie

                Hi Anton,


                I too have the same problem. I am unable to print my info message on the console in Wildfly 8.2.0 Final, even though i have added a console appender.

                Please any own helps me to over come this problem


                Thank you