title: JBoss 7 + Hibernate + Log4j
body: <p>I setup my Java EE 6 application taking as a starting point the log4j quickstart in Jboss 7.1.</p>
  
  <p>My key pom.xml additions are:</p>
  
  <pre><code>&lt;dependencyManagement&gt;
          &lt;dependencies&gt;
              &lt;!-- Define Log4j dependency and its version --&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;log4j&lt;/groupId&gt;
                  &lt;artifactId&gt;log4j&lt;/artifactId&gt;
                  &lt;version&gt;${log4j.version}&lt;/version&gt;
              &lt;/dependency&gt;
  ...
          &lt;/dependencies&gt;
      &lt;/dependencyManagement&gt;
  
  &lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>Version is 1.2.16.</p>
  
  <p>Now I can do:</p>
  
  <blockquote>
    <p>private static final Logger logger =
    Logger.getLogger(MacchinarioController.class);</p>
  </blockquote>
  
  <p>and use logger as expected. Good!</p>
  
  <p>I have no log4j.xml nor .properties files.</p>
  
  <p>Now I want Hibernate to print in console all SQL statements being executed, <strong>including parameters values</strong>.</p>
  
  <p>I created this log4j.xml and put it in src/main/resources source folder:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;!DOCTYPE log4j:configuration&gt;
  
  &lt;log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"&gt;
  
      &lt;appender name="console" class="org.apache.log4j.ConsoleAppender"&gt;
          &lt;param name="Threshold" value="info"/&gt;
          &lt;param name="Target" value="System.out"/&gt;
          &lt;layout class="org.apache.log4j.PatternLayout"&gt;
              &lt;param name="ConversionPattern" value="%d{ABSOLUTE} [%t] %-5p %c{1} - %m%n"/&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
  
      &lt;appender name="rolling-file" class="org.apache.log4j.RollingFileAppender"&gt;
          &lt;param name="file" value="Program-Name.log"/&gt;
          &lt;param name="MaxFileSize" value="1000KB"/&gt;
          &lt;param name="MaxBackupIndex" value="4"/&gt;
          &lt;layout class="org.apache.log4j.PatternLayout"&gt;
              &lt;param name="ConversionPattern" value="%d [%t] %-5p %l - %m%n"/&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
      &lt;logger name="org.hibernate"&gt;
          &lt;level value="ALL" /&gt;
      &lt;/logger&gt;
  
      &lt;root&gt;
          &lt;priority value ="debug" /&gt;
          &lt;appender-ref ref="console" /&gt;
          &lt;appender-ref ref="rolling-file" /&gt;
      &lt;/root&gt;
  &lt;/log4j:configuration&gt;
  </code></pre>
  
  <p>But nothing shows up, where am I doing wrong?</p>