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