-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Hibernate - Log4j logging : SQL not getting logged
PostPosted: Mon Aug 11, 2008 3:39 pm 
Newbie

Joined: Mon Aug 11, 2008 3:26 pm
Posts: 2
Hibernate version: - 3.0
Name and version of the database you are using:DB2390Dialect
The generated SQL (show_sql=false):

Problem: Nothing of Hibernate SQLs etc. getting logged using Log4j.

I don't want the SQLs logged to console. So we have show_sql=false in applicationContext.xml

In log4j.properties file I have the below. There is nothing logged in REPS_SQL.log
==================================
log4j.rootLogger=INFO, stdout, rollingfile

log4j.logger.org.hibernate=info
log4j.logger.org.hibernate.SQL=debug, SQLAppender
log4j.additivity.org.hibernate.SQL=false

# Pattern to output the date/time, calling class and message.
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %p %C.%M(): %m%n

log4j.appender.SQLAppender=org.apache.log4j.RollingFileAppender
log4j.appender.SQLAppender.File=/REPS_SQL.log
log4j.appender.SQLAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.SQLAppender.layout.ConversionPattern=%d{ISO8601} %p %C.%M(): %m%n

log4j.appender.rollingfile=org.apache.log4j.RollingFileAppender
log4j.appender.rollingfile.File=/REPS.log
==================================


Top
 Profile  
 
 Post subject: Re: Hibernate - Log4j logging : SQL not getting logged
PostPosted: Mon Aug 11, 2008 5:12 pm 
Beginner
Beginner

Joined: Tue Sep 27, 2005 2:51 pm
Posts: 27
smp16 wrote:
Hibernate version: - 3.0
Name and version of the database you are using:DB2390Dialect
The generated SQL (show_sql=false):

Problem: Nothing of Hibernate SQLs etc. getting logged using Log4j.

I don't want the SQLs logged to console. So we have show_sql=false in applicationContext.xml

In log4j.properties file I have the below. There is nothing logged in REPS_SQL.log
==================================
log4j.rootLogger=INFO, stdout, rollingfile

log4j.logger.org.hibernate=info
log4j.logger.org.hibernate.SQL=debug, SQLAppender
log4j.additivity.org.hibernate.SQL=false

# Pattern to output the date/time, calling class and message.
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %p %C.%M(): %m%n

log4j.appender.SQLAppender=org.apache.log4j.RollingFileAppender
log4j.appender.SQLAppender.File=/REPS_SQL.log
log4j.appender.SQLAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.SQLAppender.layout.ConversionPattern=%d{ISO8601} %p %C.%M(): %m%n

log4j.appender.rollingfile=org.apache.log4j.RollingFileAppender
log4j.appender.rollingfile.File=/REPS.log
==================================

I turned show_sql to True and I have more log entries then I know what to do with now. Give that a shot. Although now I can't get all the extra hibernate log entries to stop.

Dave Ziebol

_________________
Dave Ziebol


Top
 Profile  
 
 Post subject: Re: Hibernate - Log4j logging : SQL not getting logged
PostPosted: Mon Aug 11, 2008 5:31 pm 
Newbie

Joined: Mon Aug 11, 2008 3:26 pm
Posts: 2
By having show_sql to true I do get the SQLs logged but it is in Console. And I want them in custom Log4j log file rather than Console.

=========
I turned show_sql to True and I have more log entries then I know what to do with now. Give that a shot. Although now I can't get all the extra hibernate log entries to stop.

Dave Ziebol
==========


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.