title: Why isn't log4j2 generating a log file?
body: <p>I've been tasked with upgrading a large service type java program (not written by me, first exposure to it) that has a large collection of open source libraries.  I'm upgrading to log4j2, it previously had log4j, but I don't know if it ever worked correctly.</p>
  
  <p>I'm not getting a log file at all.  This is in a local development environment using NetBeans 8. I have the log4j-api and log4j-core 2.9.0 files in my classpath. My log4j2.xml file in the project root is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Configuration status="WARN"&gt;
  &lt;Appenders&gt;
      &lt;Console name="Console" target="SYSTEM_OUT"&gt;
          &lt;PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/&gt;
      &lt;/Console&gt;
      &lt;File name="FileAppender" fileName="DistEngine.log" immediateFlush="true" append="false" &gt;
          &lt;PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/&gt;
      &lt;/File&gt;
  &lt;/Appenders&gt;
  &lt;Loggers&gt;
      &lt;Root level="ALL"&gt;
          &lt;AppenderRef ref="FileAppender"/&gt;
          &lt;AppenderRef ref="Console"/&gt;
      &lt;/Root&gt;
  &lt;/Loggers&gt;
  </code></pre>
  
  <p></p>
  
  <p>The class logging variable is (yes, the class name is Main, and it extends a parent class):</p>
  
  <pre><code>private static final Logger MAINLOGGER = LogManager.getLogger(Main.class);
  </code></pre>
  
  <p>The first line in the main() method of this starting class is:</p>
  
  <pre><code>MAINLOGGER.info("entering listener main");
  </code></pre>
  
  <p>I'm not getting a DistEngine.log file in my project root, nor any logging from log4j2 to stdout.  I'm not getting the log4j2 message stating that it can't find the config file.</p>
  
  <p>The config file, class variable and log call are all copied from another program in this collection where the logging works correctly. </p>
  
  <p>I am getting some stdout logging from some of the open source classes, primarily in the com.sun.enterprise.ee.cms.impl.jxta and com.sun.enterprise.ee.cms.impl.jxtamgmt namespaces.  </p>
  
  <p>I have a feeling that the open source logging may be conflicting with log4j2 since the other program I copied the code from works fine.</p>
  
  <p>Thanks.</p>
  
  <p>EDIT: more resolution detail:
  One of the open source library jar files (jgroups) contained a log4j2.xml file with valid settings.  This config file was used instead of mine, since the project was configured with the lib jars in the classpath before the custom sources.  I only found this out after setting the log4j2.debug property you suggested.</p>
  
  <p>This jgroups config file didn't result in a log4j2 error, but it also didn't generate a log file that I could find.</p>
  
  <p>My solution was to put the custom source folder before the lib jars in the classpath  and it worked.  Without turning this into a classpath order thread, it seems to me custom should come first regardless of this issue, but it appears that the netbeans default is library jars first, then custom.</p>