title: Log4j not printing 3rd party logs(Spring.Hibernate etc) to RollingFileAppender
body: <p>I have been on log4j for sometime and read quite a few articles and all look pretty straight forward but when I implement it, it doesnt seem to work.</p>
  
  <p>I have the below requirement :</p>
  
  <p>1-> Need to have 2  files created for 2 different packages :</p>
  
  <p>So I created as per log4j specs and it creates 2 files based on 2 different packages but only the logs logged from our application gets logged into those files.</p>
  
  <p>The logs generated from Spring or Hibernate and Ibatis do not get logged to the file at all, but they get and all other logs do get logged to the console.</p>
  
  <p>I am placing the log4j.xml that I am using, any help would be appreciated :
  Also I have tried lots of combinations like from root appender removed the references already mentioned in the logger, adding them back to the root, add addivity to loggers but nothing worked:</p>
  
  <p>
  </p>
  
  <p></p>
  
  <pre><code>&lt;appender name="ConsoleAppender" class="org.apache.log4j.ConsoleAppender"&gt;
      &lt;param name="Threshold" value="DEBUG"/&gt;
      &lt;layout class="org.apache.log4j.PatternLayout"&gt;
          &lt;param name="ConversionPattern" value="%d{ISO8601} DSL Service(CONSOLE) %-5p %c [%t]: %m%n%n"/&gt;
      &lt;/layout&gt;
  &lt;/appender&gt;
  
  &lt;appender name="FEPOCServiceLog"
      class="org.apache.log4j.RollingFileAppender"&gt;
      &lt;param name="Append" value="true"/&gt;
      &lt;param name="maxFileSize" value="100KB" /&gt;
      &lt;param name="maxBackupIndex" value="5" /&gt;
      &lt;param name="File" value="C:\\tmp\\DSLService_1.0.log" /&gt;
      &lt;param name="threshold" value="DEBUG"/&gt;
      &lt;layout class="org.apache.log4j.PatternLayout"&gt;
          &lt;param name="ConversionPattern"
              value="%d{ISO8601} DService(CONSOLE) %-5p %c [%t]: %m%n%n" /&gt;
      &lt;/layout&gt;
  &lt;/appender&gt;
  
  &lt;appender name="iServiceLog"
      class="org.apache.log4j.RollingFileAppender"&gt;
      &lt;param name="maxFileSize" value="10MB" /&gt;
      &lt;param name="maxBackupIndex" value="5" /&gt;
      &lt;param name="File" value="C:\\tmp\\iService_1.0.log" /&gt;
      &lt;param name="threshold" value="DEBUG"/&gt;
      &lt;layout class="org.apache.log4j.PatternLayout"&gt;
          &lt;param name="ConversionPattern"
              value="%d{ISO8601} iService(CONSOLE) %-5p %c [%t]: %m%n%n" /&gt;
      &lt;/layout&gt;
  &lt;/appender&gt;
  </code></pre>
  
  <p>Hope this helps :</p>
  
  <pre><code>&lt;logger name="com.fepoc.services.dataservice"&gt;
      &lt;level value="DEBUG"/&gt;
      &lt;appender-ref ref="FEPOCServiceLog"/&gt;                 
  &lt;/logger&gt;
  
  &lt;logger name="com.fepoc.mpbit"&gt;
      &lt;level value="DEBUG"/&gt;
      &lt;appender-ref ref="iServiceLog"/&gt;                 
  &lt;/logger&gt;
  
  &lt;logger name="net.sf.hibernate"&gt;
      &lt;level value="DEBUG"/&gt;  
      &lt;appender-ref ref="FEPOCServiceLog"/&gt;               
  &lt;/logger&gt;
  
  
  &lt;logger name="org.hibernate"&gt;
      &lt;level value="DEBUG"/&gt;
      &lt;appender-ref ref="FEPOCServiceLog"/&gt;                 
  &lt;/logger&gt;
  
  &lt;logger name="com.mchange.v2"&gt;
      &lt;level value="DEBUG"/&gt;   
      &lt;appender-ref ref="FEPOCServiceLog"/&gt;              
  &lt;/logger&gt;
  
  &lt;logger name="com.ibatis.sqlmap"&gt;
      &lt;level value="DEBUG"/&gt;     
      &lt;appender-ref ref="FEPOCServiceLog"/&gt;            
  &lt;/logger&gt;
  
  &lt;logger name="org.springframework"&gt;
      &lt;level value="DEBUG"/&gt;
      &lt;appender-ref ref="FEPOCServiceLog"/&gt;                 
  &lt;/logger&gt;
  </code></pre>
  
  <p>...</p>
  
  <pre><code>   &lt;root&gt; 
  &lt;priority value ="debug" /&gt; 
  &lt;appender-ref ref="ConsoleAppender"/&gt;
  &lt;appender-ref ref="FEPOCServiceLog"/&gt;        
  &lt;appender-ref ref="iServiceLog"/&gt;        
  </code></pre>
  
  <p></p>
  
  <p></p>
  
  <p>Thanks,
  NK</p>