-->
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.  [ 1 post ] 
Author Message
 Post subject: How to Display Hibernate SQL queries on JSP page?
PostPosted: Tue May 17, 2005 2:57 am 
Newbie

Joined: Tue May 17, 2005 2:24 am
Posts: 5
Hi,

In a session, I need to show the executed SQL queries on the JSP page. Have anybody tried this before?

I configured Hibernate to work with Log4j, and provided the settings

### 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

### direct messages to file hibernate.log ###
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=hibernate.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

### set log levels - for more verbose logging change 'info' to 'debug' ###

log4j.rootLogger=error, stdout, file

### log just the SQL
log4j.logger.org.hibernate.SQL=debug
log4j.logger.org.hibernate.type=debug



in the log4j.properties file. With this I'm able to get the SQL queries in the log file. But, is there a way, by which I can route the session specific queries to the out stream, and show it on the Web page?

I also tried to capture the SQL logs in JSP page using the opensource LOG taglib, but that was not a successful experiment.

An early reply to this challenging question is awaited.

Cheers!
Hibernaut.


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

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.