title: netbeans glassfish hibernate log4j2
body: <p>I have a simple Netbeans 7.1.2 (NON MAVEN) project that use glassfish 3.1 server for testing.</p>
  
  <p>I created a log4j2.xml file and placed it on the classpath 
  here it is </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"&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="debug"/&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="c:\tmp\Program-Name.log"/&gt;
          &lt;param name="MaxFileSize" value="500KB"/&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="info" /&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>the project uses hibernate to store data from a web service to a database. </p>
  
  <p>However I am not able to log anything. I can see the logs of hibernate into the Netbeans IDE but I cannot see the created on the filesystem file.</p>
  
  <p>I have this error when calling the web service</p>
  
  <pre><code>SEVERE: ERROR StatusLogger Unknown object "logger" of type org.apache.logging.log4j.core.config.LoggerConfig is ignored
  SEVERE: ERROR StatusLogger root contains an invalid element or attribute "priority"
  SEVERE: ERROR StatusLogger Unknown object "root" of type org.apache.logging.log4j.core.config.LoggerConfig is ignored
  </code></pre>
  
  <p>could someone pls help or give some advice I googled and stackoverflowed but without chance.</p>
  
  <p>Paolo</p>