1

I got a maven+struts2+spring+hibernate project running in Weblogic, and I don´t want to see the queries, parameters and data from hibernate. I already put the property show_sql = false, from hibernate.cg.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>

    <session-factory>
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="show_sql">false</property>
        <property name="hbm2ddl.auto">update</property>
        <!-- Generales -->
        <mapping resource="mappings/generales/Archivo.hbm.xml" />    
    </session-factory>
</hibernate-configuration>

and this is my log4j properties file:

# Direct log messages to a log file  
log4j.appender.file=org.apache.log4j.RollingFileAppender  
log4j.appender.file.File=C:\\javatpointhibernate.log  
log4j.appender.file.MaxFileSize=1MB  
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  

# Direct log messages to stdout  
log4j.appender.stdout=org.apache.log4j.ConsoleAppender  
log4j.appender.stdout.Target=System.out  
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout  
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n  

# Root logger option  
log4j.rootLogger=INFO, file, stdout  

# Log everything. Good for troubleshooting  
log4j.logger.org.hibernate=WARN  
log4j.logger.org.hibernate.SQL=OFF   
# Log all JDBC parameters  
log4j.logger.org.hibernate.type=WARN 

I compile it with eclipse and then with maven and finally I opened the WAR and checked my log4j and my hibernate files to see if it has the changes and it does, but I get the hsql queries from the methods where I use hsql, the native sql queries from the methods where I use native sql and the parameters with values. So what else am I missing, so that hibernate stops appearing in my weblogic console. Thanks in advance!!

linker85
  • 1,601
  • 5
  • 26
  • 44
  • Does this helps ? http://stackoverflow.com/questions/311408/turning-off-hibernate-logging-console-output – Jay Sep 08 '15 at 19:17
  • I try changeing the level to info as it was posted, but unfortunately it didn´t work. :( – linker85 Sep 08 '15 at 20:14

0 Answers0