title: Tomee - slf4j create logs file but not writing on them
body: <p>I want to use log4j for my app (I don't need to handle the server logs for now). I searched for a solution but all post are related with server logs. When I run the app, the log4j.properties is read and the logs file are created but it didn't write on them.</p>
  
  <p>I'm using Tomee as server. I have other project with Wildfly using the same solution for log4j and it works.</p>
  
  <p>log4j.properties:</p>
  
  <pre><code>log4j.appender.TEST = org.apache.log4j.DailyRollingFileAppender
  log4j.appender.TEST.File = /opt/share/test-project/logs/test.log
  log4j.appender.TEST.DatePattern = '.'yyyy-MM-dd
  log4j.appender.TEST.layout = org.apache.log4j.PatternLayout
  log4j.appender.TEST.layout.ConversionPattern = [%d{ISO8601}] %5p - %x - %c.%M(%L): %m%n
  
  # Define the types of logger and level of logging    
  #log4j.rootLogger.org = DEBUG,CONSOLE
  log4j.logger.com.test=DEBUG, TEST
  </code></pre>
  
  <p>Log4jConfig class which is initialized:</p>
  
  <pre><code>import java.io.File;
  
  import javax.servlet.ServletContextEvent;
  import javax.servlet.ServletContextListener;
  import javax.servlet.annotation.WebListener;
  
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  import org.apache.log4j.PropertyConfigurator;
  
  @WebListener
  public class Log4jConfig implements ServletContextListener {
  
  
      private final static String LO4G_FILENAME="/opt/share/test-project/config/log4j.properties"; 
      private static final Logger LOGGER = LoggerFactory.getLogger(Log4jConfig.class);
  
  ...
  ...
      public void contextInitialized(ServletContextEvent arg0)
      { 
  
          try{
              File file = new File(LO4G_FILENAME);
              if (file.exists())
              {
                  PropertyConfigurator.configure(LO4G_FILENAME);
                  LOGGER.info("[Log4JInitServlet - contextInitialized] - Log4J configured:"+LO4G_FILENAME);
              }
  
          }catch (Exception e) {
              LOGGER.error("[Log4JInitServlet - contextInitialized] - Exception &gt;&gt;",e);
          }
  
      }
  
  }
  </code></pre>
  
  <p>Test.java:</p>
  
  <pre><code>import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  
  import com.google.gson.Gson;
  
  @Path("/test")
  public class TestWs {
  
      private static final Logger LOGGER = LoggerFactory.getLogger(TestWs.class.getName());
      //here LOGGER is null. If I put it into test() is not null but not write on the log either.
  
      @GET
      @Path("/")
      @Produces(MediaType.APPLICATION_JSON)
      public Response test(){
  
          LOGGER.debug("[TestWs - init] - init");
          long currentSystemTime = System.currentTimeMillis();
  
          LOGGER.error("[TestWs - test] - Error: TEST");
          LOGGER.debug("[TestWs - test] - Finish Timing:"+(System.currentTimeMillis()-currentSystemTime));
  
          return Response.ok().build();
  
      }
  }
  </code></pre>
  
  <p>POM.xml:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
      &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
      &lt;version&gt;1.7.12&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
      &lt;artifactId&gt;log4j-over-slf4j&lt;/artifactId&gt;
      &lt;version&gt;1.7.12&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>Any idea?</p>