Set Factory SQL Logger

16 views
Skip to first unread message

Ravi Mendis

unread,
May 13, 2011, 3:56:33 AM5/13/11
to squeryl-co...@googlegroups.com
Hi Max,

I know i've asked before, but is there going to be a way to set a SQL logger globally i.e at the Factory instead of having to add a line to each and every transaction? E.g:

transaction {

     squeryl.Session.currentSession.setLogger(println())

     ...

}


My code is littered with SQL log statements :)


Thx,

Ravi

Maxime Lévesque

unread,
May 13, 2011, 5:51:25 AM5/13/11
to squeryl-co...@googlegroups.com

You can set it in the session factory :

SessionFactory.concreteFactory = Some(
  ()=> {
    val s = Session.create(java.sql.DriverManager.getConnection("..."),new PostgreSqlAdapter)
    s.setLogger(..)
    s
  }
)

then you only need to set it once...

ML

Reply all
Reply to author
Forward
0 new messages