I put this in the code
Code:
Logger logger = LogManager.getLogger("net.sf.hibernate.SQL");
logger.setLevel((Level) Level.DEBUG);
before running the HQL and put
Code:
logger.setLevel((Level) Level.ERROR);
after running the HQL.
The sql satements
did not get printed in the log or on the console.
In the log4j.lcf file I added
Code:
log4j.logger.net.sf.hibernate.SQL=debug
but it makes no difference.
The only way I can get the system to print the sql to the log/console is by setting hibernate's show_sql to true in the hibernate.properties file:
Code:
hibernate.show_sql true
But this turns sql logging on for all the sqls whereas I want to turn it on selectively.
What am I doing wrong? It feels like I am missing something obvious!