• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

How to supress SQL Queries in log file

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Threshold" value="info"/>
<param name="Target" value="System.out"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} [%t] %-5p %c{1} - %m%n"/>
</layout>
<filter class="org.apache.log4j.filter.ExpressionFilter">
<param name="Expression" value="EXCEPTION ~= org.hibernate.LazyInitializationException"/>
<param name="AcceptOnMatch" value="false"/>
</filter>
</appender>
<root>
<priority value ="warn" />
<appender-ref ref="console" />
<!--<appender-ref ref="rolling-file" />
--></root>
</log4j:configuration>


this is my log4j.xml file,
can you help me out how to supress sql statements in log4j and i am getting some warnings like log4j is not initialized properly.

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I hope you are using Hibernate and getting SQL queries also printed in log file.
If this is the case, Please make the show_sql property as false in hibernate config file. This will turn off the feature of sql getting printed.
 
reply
    Bookmark Topic Watch Topic
  • New Topic