Title: Message
But hibernate has all he needs to ouput the bind parameter of the sql call. Hibernate has to build the sql call, so at the moment he build the request he can output this request with the bind parameter. In the log4J property file there is:
 
### log JDBC bind parameters ###
log4j.logger.net.sf.hibernate.type=debug
 
Which I think does the work. But i can't figure out how to make hibernate use log4J for the sql call.
 
Thanks for the help!!
 
Philip
-----Message d'origine-----
De : Cameron Braid [mailto:[EMAIL PROTECTED]
Envoyé : 6 novembre, 2003 08:57
À : St-Pierre Philip
Objet : Re: [Hibernate] Show_sql??

What I tend to do is either

a) configure mysql to log statements to a file
or
b) use p6spy jdbc proxy and configure it to log statements
or
c) use proxool as the pool / driver  and configure it to log statements

I dunno if hibernate will be able to do this since I think it is the JDBC driver that does the substitution internally.

Cameron

St-Pierre Philip wrote:

Hi everyone,
                When show_sql is set to true, we get message like that, with ? Sign in place of the bind parameter:

Hibernate: select t_activi0_.ID_ACO as ID_ACO__, ..., t_activi0_.ID_CC as ID_CC from DET.T_ACTIVITE_COMMERCIALE t_activi0_ where t_activi0_.ID_CC=?

Is it possible to replace those ? marks by the corresponding bind parameter? I tried logging with log4J as explained in the section 2.7 of the Hibernate2 Reference Documentation, but hibernate seems not to see log4J. I placed the following file in my class path:

### 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=warn, stdout

log4j.logger.net.sf.hibernate=debug

### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
#log4j.logger.net.sf.hibernate.connection.DriverManagerConnectionProvider=trace

### log JDBC bind parameters ###
log4j.logger.net.sf.hibernate.type=debug

### log prepared statement cache activity ###
log4j.logger.net.sf.hibernate.ps.PreparedStatementCache=debug

And also placed the log4j.jar file in my classpath. Bug this doesn't work. Does someone knows how to achieve that?

Thanks

Philip St-Pierre
Loto-Québec - Projet IRIS (Centre de livraison)
Analyste-Programmeur



-- 
Any damn fool can write code that a computer can understand...
The trick is to write code that humans can understand.
[Martin Fowler http://www.martinfowler.com/distributedComputing/refactoring.pdf]

Reply via email to