title: Log4j Print Extended Class Name
body: <p>How I can log the name of extended class? I want "FTSControl" written instead of "Control".</p>
  
  <pre><code>public abstract class Control {   
      Logger logger = Logger.getLogger(getClass());   
  }
  
  @Component
  public class FTSControl extends Control { 
  
  }
  
  &lt;layout class="org.apache.log4j.PatternLayout"&gt;
      &lt;param name="ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss.SSS} %-5p - %C{1}:%m%n" /&gt;
  &lt;/layout&gt;
  </code></pre>
  
  <p><strong>Output:</strong>  </p>
  
  <pre><code>09.01.2015 15:58:00.006 WARN  - Control: No files found! Hash:-844390824
  </code></pre>
  
  <p>I have also point out sometinh that,</p>
  
  <p>Although same logger instance is used,  log.info() invocation in a method of Control and FTSControl print its own class name. I mean </p>
  
  <p><em>logger.info() in  a method of <strong>FTSControl</strong> prints</em></p>
  
  <pre><code>09.01.2015 15:58:00.006 WARN  - FTSControl : No files found! Hash:-844390824
  </code></pre>
  
  <p><em>logger.info() in  a method of <strong>Control</strong> prints</em></p>
  
  <pre><code>09.01.2015 15:58:00.006 WARN  - Control: No files found! Hash:-844390824
  </code></pre>
  
  <p><strong>//Update  Complete Example</strong> </p>
  
  <pre><code>package com.log;
  
  import org.apache.log4j.Logger;
  import org.apache.log4j.xml.DOMConfigurator;
  
  import com.log.abstracttest.ControlAbs;
  import com.log.abstracttest.ImosControl;
  
  
  public class LogMainTest {
  
      private Logger logger = Logger.getLogger("console");
  
      public  LogMainTest(){
          DOMConfigurator.configure(this.getClass().getClassLoader().getResource("log4j.xml"));
          logger.info("Initializing...");
  
          ImosControl control = new ImosControl();
          control.print();
          control.printAll();
  
      }
  
      public static void main(String[] args) {
          new LogMainTest();
  
      }
  
  
  }
  
  
  package com.log.abstracttest;
  
  import org.apache.log4j.Logger;
  
  public abstract class ControlAbs {
      Logger logger = Logger.getLogger(this.getClass());
  
      public void print(){
          logger.info(" print");
      }
  
  }
  
  
  package com.log.abstracttest;
  
  public class ImosControl extends ControlAbs {
  
      public void printAll(){
          logger.info("printAll");
      }
  
  }
  </code></pre>
  
  <p><strong>Output:</strong></p>
  
  <pre><code>10.01.2015 05:38:43.497 INFO  - LogMainTest:Initializing...
  10.01.2015 05:38:43.502 INFO  - ControlAbs: print
  10.01.2015 05:38:43.503 INFO  - ImosControl:printAll
  </code></pre>