Re: [basedb-devel] Query tracing

2009-06-08 Thread Nicklas Nordborg
Olivier Lefevre wrote:
 I am developing a service. How can I enable query tracing so that
 Query.list() appends the SQL or HQL form of the query to one of the
 Tomcat log files? My 'or' queries (Restrictions.or) seem to work 
 ok but not my 'and' queries and I'd like to see what's going on.


This can be enabled in the log4j.properties file which you find in the
WEB-INF/classes folder. There are a lot of options but the one you are
looking for is: log4j.logger.net.sf.basedb.core.query.ql=debug

Just uncomment this and the HQL/SQL should be logged. If your query is
a HQL query you may want the SQL Hibernate generates as well. This
is controlled by log4j.logger.org.hibernate.SQL=debug.

/Nicklas

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
basedb-devel mailing list
basedb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/basedb-devel


Re: [basedb-devel] Query tracing

2009-06-08 Thread Olivier Lefevre

Thanks. By the way, why were WHERE SQL clauses mapped to the
unintuitive Restriction rather than Where, like ORDER was
mapped to Order?

-- O.L.


--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
basedb-devel mailing list
basedb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/basedb-devel


Re: [basedb-devel] Query tracing

2009-06-08 Thread Nicklas Nordborg
Olivier Lefevre wrote:
 Thanks. By the way, why were WHERE SQL clauses mapped to the
 unintuitive Restriction rather than Where, like ORDER was
 mapped to Order?

Restrictions can appear in other places also. For example in
queries with GROUP BY expression HAVING restriction

/Nicklas

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
basedb-devel mailing list
basedb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/basedb-devel


Re: [basedb-devel] Query tracing

2009-06-08 Thread Olivier Lefevre

OK, so I enabled that and it did not show me all I wanted at
first. In case someone should hit this thread using the search 
function in the future, I think I'd finish the story.

If a WHERE clauses involves a constant string, the HQL log will
shows some kind of hash instead of the string because of how 
Expressions.string works. Then, too, apparently the SQL is a stored
proc and it is shown with '?' in lieu of actual parameters, so again
you don't see your string. In order to get the full scoop you need 
log4j.logger.net.sf.basedb.core.query.bind=debug

-- O.L.


--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
basedb-devel mailing list
basedb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/basedb-devel