How does one turn on SQL logging?
I'm trying out the new SessionFactory and transaction {} notation -
and i have to say i'm liking it ;)
It actually makes my code less verbose, but there's one thing i've not
figured out...
When using:
SessionFactory.concreteFactory = Option(() => Session.create(
java.sql.DriverManager.getConnection("jdbc:postgresql://
localhost:5432/sque ryl", "squeryl", "squeryl"),
new PostgreSqlAdapter
))
What is the new way of setting a logger for SQL?
Thanks,
Ravi
On Mar 1, 2:51 pm, Maxime Lévesque <maxime.leves...@gmail.com> wrote:
> Hi Ravi, nice to hear that Squeryl is doing usefull work ! ;-)
>
> There are two ways of seeing the generated SQL :
>
> 1) The org.squery.Query[T].statement: String method, ex :
>
> val q = aTable.where(t => t.aField === x)
>
> println(q.statement)
>
> 2) The org.squeryl.Session.setLogger(String=>Unit) method, ex :
>
> Session.currentSession.setLogger(msg => println(msg))
>
> With this method you will see pretty much every statement passed to jdbc,
> and a dump of result sets of the seesion.
>
> Cheers !
>
> Max
>
you can call it at any time
Session.currentSession.setLogger(msg => {...do something with msg} )
provided that there is a Session bound to the current thread, wich is
the case
if you are inside a transaction.
Cheers !
To unsubscribe from this group, send email to squeryl+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.