title: Struts 1.x internal logging using log4j2
body: <p>I have built a sample web application using struts 1.3. I am trying to print the logs using log4j2 but i am unable to get the struts logs in the log file</p>
  
  <p>I have tried creating a logger for struts in log4j2. properties file as below </p>
  
  <pre><code>status = info
  log4j2.debug = true
  
  appender.file.type = File
  appender.file.name = LOGFILE
  appender.file.fileName=/test/logs/struts.log
  appender.file.layout.type=PatternLayout
  appender.file.layout.pattern= %d{yyyy-MM-dd HH:mm:ss.SSS} &lt;%t&gt;(%-6X{sys:user}) %2.2x - %msg%n
  
  loggers = org.apache.struts,com.myapp.struts
  logger.org.apache.struts.name = org.apache.struts
  logger.org.apache.struts.level = trace
  logger.org.apache.struts.appenderRef.file.ref = LOGFILE
  logger.org.apache.struts.additivity = false
  
  logger.com.myapp.struts.name = com.myapp.struts
  logger.com.myapp.struts.level = trace
  logger.com.myapp.struts.appenderRef.file.ref = LOGFILE
  logger.com.myapp.struts.additivity = false
  
  rootLogger.level = trace
  </code></pre>
  
  <p>i am still not getting the logs. The below is my project directory</p>
  
  <p><a href="https://i.stack.imgur.com/ocuXF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ocuXF.png" alt="enter image description here"></a></p>
  
  <p>The loginform class is as below</p>
  
  <pre><code>package com.myapp.struts;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import org.apache.struts.action.ActionForm;
  import org.apache.struts.action.ActionForward;
  import org.apache.struts.action.ActionMapping;
  import org.apache.logging.log4j.LogManager;
  import org.apache.logging.log4j.Logger;
  
  public class loginform extends org.apache.struts.action.Action 
  {
  
      static final Logger log = LogManager.getLogger(loginform.class);
      private static final String SUCCESS = "success";
      private static final String FAILURE = "failure";
      @Override
      public ActionForward execute(ActionMapping mapping, ActionForm form,
              HttpServletRequest request, HttpServletResponse response)
              throws Exception 
      {
          log.info("Inside the loginform class");
          log.info("Execute method called");
          loginbean lb = (loginbean)form;
          if(lb.getUname().equals("abc")&amp;&amp; lb.getUpass().equals("xyz"))
          {
             log.info("Login successful...redirecting to success page");
             log.info("Exiting execute");
             return mapping.findForward(SUCCESS);
          }
          else
          {
             log.info("Login failed...redirecting to failure page");
             log.info("Exiting execute");
             return mapping.findForward(FAILURE); 
          }
      }
  }
  </code></pre>
  
  <p>I get the logs printed in the above class but i dont get any logs from the struts even though i  have configured a logger for it. Basically i am looking for logs like.</p>
  
  <pre><code>Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
  </code></pre>