title: Turn off hibernate logging on stdout
body: <p>Please read complete question and then think of the possibility of being duplicate.</p>
  
  <p><strong>I have gone through several question on stackoverflow and they suggested ways to turn off hibernate logging on <code>stdout</code>.</strong> </p>
  
  <p>I could successfully turn off hibernate logging on <code>stdout</code> when I use <code>maven</code> to run the jar file of my application (<code>mvn exec:java -Dexec.mainClass="org.flytxt.JobMonitor"</code>). This was achieved by using <code>log4j.prpoerties</code> file.</p>
  
  <p>The output on <code>stdout</code> by using <code>maven</code> shown below:</p>
  
  <p><img src="https://i.stack.imgur.com/7hKng.png" alt="enter image description here"></p>
  
  <p>But when I use the same jar file packaged by <code>maven</code> (can be found in the <code>target</code> subdirectory of the project directory), add all jars into the MANIFEST.MF manually and execute it (<code>java -jar JobMonitor-1.0-SNAPSHOT.jar</code>), I see too much DEBUG logging info of hibernate on <code>stdout</code> like show below:</p>
  
  <pre><code>root@fly-dt223:/home/rohit/workspace_dfe/JobMonitor/JobMonitor/daemon# java -jar JobMonitor-1.0-SNAPSHOT.jar 
  17:00:41.954 [192.168.151.50] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider
  17:00:41.965 [192.168.151.50] DEBUG org.hibernate.type.BasicTypeRegistry - Adding type registration boolean -&gt; org.hibernate.type.BooleanType@1ef8deca
  17:00:41.965 [192.168.151.50] DEBUG org.hibernate.type.BasicTypeRegistry - Adding type registration boolean -&gt; org.hibernate.type.BooleanType@1ef8deca
  17:00:41.965 [192.168.151.50] DEBUG org.hibernate.type.BasicTypeRegistry - Adding type registration java.lang.Boolean -&gt; org.hibernate.type.BooleanType@1ef8deca
  17:00:41.966 [192.168.151.50] DEBUG org.hibernate.type.BasicTypeRegistry - Adding type registration numeric_boolean -&gt; org.hibernate.type.NumericBooleanType@1ce2a846
  17:00:41.967 [192.168.151.50] DEBUG org.hibernate.type.BasicTypeRegistry - Adding type registration true_false -&gt; org.hibernate.type.TrueFalseType@1ce7df90
  17:00:41.967 [192.168.151.50] DEBUG org.hibernate.type.BasicTypeRegistry - Adding type registration yes_no -&gt; org.hibernate.type.YesNoType@40d2a14b
  17:00:41.968 [192.168.151.50] DEBUG org.hibernate.type.BasicTypeRegistry - Adding type registration byte -&gt; org.hibernate.type.ByteType@2b6167ab
  17:00:41.968 [192.168.151.50] DEBUG org.hibernate.type.BasicTypeRegistry - Adding type registration byte -&gt; org.hibernate.type.ByteType@2b6167ab
  17:00:41.968 [192.168.151.50] DEBUG org.hibernate.type.BasicTypeRegistry - Adding type registration java.lang.Byte -&gt; org.hibernate.type.ByteType@2b6167ab
  17:00:41.969 [192.168.151.50] DEBUG org.hibernate.type.BasicTypeRegistry - Adding type registration character -&gt; org.hibernate.type.CharacterType@6ba47ef5
  17:00:41.969 [192.168.151.50] DEBUG org.hibernate.type.BasicTypeRegistry - Adding type registration char -&gt; org.hibernate.type.CharacterType@6ba47ef5
  17:00:41.969 [192.168.151.50] DEBUG org.hibernate.type.BasicTypeRegistry - Adding type registration java.lang.Character -&gt; org.hibernate.type.CharacterType@6ba47ef5
  17:00:41.970 [192.168.151.50] DEBUG org.hibernate.type.BasicTypeRegistry - Adding type registration short -&gt; org.hibernate.type.ShortType@39614c6
  17:00:41.971 [192.168.151.50] DEBUG org.hibernate.type.BasicTypeRegistry - Adding type registration short -&gt; org.hibernate.type.ShortType@39614c6
  17:00:41.972 [192.168.151.50] DEBUG org.hibernate.type.BasicTypeRegistry - Adding type registration java.lang.Short -&gt; org.hibernate.type.ShortType@39614c6
  17:00:41.973 [192.168.151.50] DEBUG org.hibernate.type.BasicTypeRegistry - Adding type registration integer -&gt; org.hibernate.type.IntegerType@1621a02b
  </code></pre>
  
  <p>My application uses <code>log4j.properties</code> and its content is shown below. </p>
  
  <pre><code>log4j.appender.file=org.apache.log4j.RollingFileAppender
  log4j.appender.file.File=/tmp/hibernate.log
  log4j.appender.file.MaxFileSize=10MB
  log4j.appender.file.MaxBackupIndex=1
  log4j.appender.file.layout=org.apache.log4j.PatternLayout
  log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
  log4j.rootLogger=INFO, file
  log4j.logger.org.hibernate=INFO
  log4j.logger.org.hibernate.type=INFO
  </code></pre>
  
  <p>It appears that maven is loading <code>log4j.properties</code> file from either the jar file itself or from the other path.
  Below are the locations of <code>log4j.properties</code> file within my project directory structure:</p>
  
  <p><img src="https://i.stack.imgur.com/cNreM.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/omSQB.png" alt="enter image description here"></p>
  
  <p>So, my question is: How can I stop hibernate to log on <code>stdout</code> and make it log into a file as pointed in the content of the file <code>log4j.properties</code> shown above when I use simply <code>java -jar JobMonitor-1.0-SNAPSHOT.jar</code> ?</p>
  
  <p>I assume, it is likely that my application could not locate <code>log4j.properties</code> while using the command <code>java -jar JobMonitor-1.0-SNAPSHOT.jar</code>. </p>