10 Replies Latest reply on May 29, 2013 10:35 AM by erasmo2 marciano2

    Problem with log4j + Jboss AS 7.1.1

    Ariel Quiroz Newbie

      PD: Sorry for my english, I don´t Know English XD


      Hi.. all


      I have an web application with Jboss 7.1.1 + JSF 2.0 + Richfaces + Hibernate . Y want use log4j for show my logs.

      My problem is wich no show me the messagges DEBUG however show me the messagges INFO.

      Please Please help us in resolving this log4j + Jboss AS 7.1.1


      So ready configure mi log4j.properties.xml:


      log4j.rootLogger=DEBUG, stdout


      ### direct log messages to stdout ###




      log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n


      my jboss-deployment-structure.xml:


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

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">


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

              <sub-deployment name="your-subdeployment.jar">


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

              <module name="org.slf4j" />

              <module name="org.apache.commons.logging"/>

              <module name="org.log4j"/> 

              <module name="org.jboss.logging"/>





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





      my  servlet:

      import java.io.File;


      import javax.servlet.ServletConfig;

      import javax.servlet.ServletContext;

      import javax.servlet.ServletException;

      import javax.servlet.http.HttpServlet;


      import org.apache.log4j.BasicConfigurator;

      import org.apache.log4j.PropertyConfigurator;


      public class Log4JInitServlet extends HttpServlet{





          private static final long serialVersionUID = -3677208571865966932L;




          public void init(ServletConfig config) throws ServletException {

             System.out.println("Initialising log4j");

             String log4jLocation = config.getInitParameter("log4j-properties-location");


             ServletContext sc = config.getServletContext();


             if (log4jLocation == null) {

                System.out.println("No log4j properites...");


             } else {

                String webAppPath = sc.getRealPath("/");

                String log4jProp = webAppPath + log4jLocation;

                File output = new File(log4jProp);


                if (output.exists()) {

                   System.out.println("Initialising log4j with: " + log4jProp);


                } else {

                   System.out.println("Find not found (" + log4jProp + ").");










      and this is configure in my web.xml