title: Log file is not being generated in log4j2 in spring boot application
body: <p>I know there are a lot of post similar to this one, but no solution inside them worked for me. I have created a simple java code in eclipse and I am getting the output in the console screen, but the log file is not getting generated.</p>
  <p><strong>log4j2.properties</strong>:</p>
  <pre><code>name=PropertiesConfig
  property.filename = logs
  appenders = console, file
  
  appender.console.type = Console
  appender.console.name = STDOUT
  appender.console.layout.type = PatternLayout
  appender.console.layout.pattern = [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
  
  appender.file.type = File
  appender.file.name = LOGFILE
  appender.file.fileName=${filename}/propertieslogs.log
  appender.file.layout.type=PatternLayout
  appender.file.layout.pattern=[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
  appender.file.append=true
  appender.file=org.apache.log4j.RollingFileAppender
  
  loggers=file
  logger.file.name=Processors
  logger.file.level = trace
  logger.file.appenderRefs = file
  logger.file.appenderRef.file.ref = LOGFILE
  
  rootLogger.level = trace
  rootLogger.appenderRefs = stdout
  rootLogger.appenderRef.stdout.ref = STDOUT
  rootLogger= INFO, file, stdout
  </code></pre>
  <p><strong>dependencies</strong>:</p>
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-log4j2&lt;/artifactId&gt;
      &lt;version&gt;2.6.1&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  <p><strong>java code</strong>:</p>
  <pre><code>public class GetRoomsProcessor implements Processor{    
  private static Logger logger = LogManager.getLogger(GetRoomsProcessor.class);   
      
      public void process(Exchange xchg) throws Exception {
          
          
      ...
    
    String statusCode = String.valueOf(response.statusCode());
      if (statusCode.equals(&quot;200&quot;) || statusCode.equals(&quot;201&quot;)) {
      ...
  
            rooms.setRooms(listdata);
            Gson g = new Gson();  
            String str = g.toJson(rooms);  
            //System.out.println(str);
            logger.info(str);
            logger.warn(&quot;This is a warn message&quot;);
            logger.trace(&quot;This is a trace message&quot;);
           xchg.getIn().setBody(str);
          }
  </code></pre>
  <p>What do I need to do to write logs to a file?
  Thank you</p>
  <p><strong>update</strong>:
  I tried to add also the following dependencies and still did not work:</p>
  <pre><code>&lt;dependency&gt;
     &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
     &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&gt;
     &lt;exclusions&gt;
        &lt;exclusion&gt;
           &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
           &lt;artifactId&gt;spring-boot-starter-logging&lt;/artifactId&gt;
        &lt;/exclusion&gt;
     &lt;/exclusions&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
     &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
     &lt;artifactId&gt;log4j-api&lt;/artifactId&gt;
     &lt;version&gt;2.16.0&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
     &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
     &lt;artifactId&gt;log4j-core&lt;/artifactId&gt;
     &lt;version&gt;2.16.0&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>