Could this be a JDK 1.5 vs. 1.6 issue?
On Mon, Sep 28, 2009 at 10:43 AM, David <[email protected]> wrote:
>
> Nope, changed to println():
>
> DB.addLogFunc {
> case (query, time) => {
> println("All queries took " + time + "ms: ")
> query.allEntries.foreach({ case DBLogEntry(stmt, duration) =>
> println(stmt + " took " + duration + "ms")})
> println("End queries")
> }
> }
>
> Nothing on console.
>
> Thanks, David
>
> On Sep 28, 1:36 pm, Derek Chen-Becker <[email protected]> wrote:
> > I tested it locally on my own code and it works. Just for giggles, does
> > anything print on the console if you change those lines to println?
> >
> > Derek
> >
> > On Wed, Sep 23, 2009 at 2:39 PM, David <[email protected]> wrote:
> >
> > > Hello, I'm trying to use the new logging information as described
> > > here. In my Boot I have:
> >
> > > import net.liftweb.mapper.{DB, DBLogEntry}
> > > snip...
> >
> > > DB.addLogFunc {
> > > case (query, time) => {
> > > Log.info("All queries took " + time + "ms: ")
> > > query.allEntries.foreach({ case DBLogEntry(stmt, duration) =>
> > > Log.info(stmt + " took " + duration + "ms")})
> > > Log.info("End queries")
> > > }
> > > }
> >
> > > I'm using slf4j and logback, my root level is set to trace. I see
> > > trace output from lift, like:
> > > 16:32:02.208 [5991...@qtp-10429832-0] TRACE lift.trace:76 - Released
> > > connection ConnectionIdentifier(lift) on thread Thread
> > > [5991...@qtp-10429832-0,5,main]
> >
> > > But I don't see any output from the DB log functions. Is there
> > > anything else I need to do in order to enable logging? I'm using
> > > scala 2.7.5 and lift 1.1-SNAPSHOT.
> >
> > > Thanks, Dave
> >
> > > On Aug 28, 1:20 pm, "marius d." <[email protected]> wrote:
> > > > EXCELLENT WORK DEREK !
> >
> > > > On Aug 28, 7:28 pm, Derek Chen-Becker <[email protected]> wrote:
> >
> > > > > Hi all,
> > > > > I've made a change to the Mapper logging functionality in
> > > > > wip-dcb-sql-log-wrappers. The DB.addLogFuncmethod has changed to:
> >
> > > > >addLogFunc( f: (DBLog,Long) => Any)
> >
> > > > > where DBLog is a new trait (below) and the Long corresponds to the
> > > *total*
> > > > > duration of a given DB execution method. DBLog is defined as:
> >
> > > > > trait DBLog {
> > > > > ... private stuff up here ...
> > > > > /** Return a list of all of the DBStatementEntry instances in the
> log
> > > > > buffer */
> > > > > def statementEntries : List[DBStatementEntry] = ...
> >
> > > > > /** Return a list of all of the DBMetaEntry instances in the log
> > > buffer */
> > > > > def metaEntries : List[DBMetaEntry] = ...
> >
> > > > > /** Return all log buffer entries */
> > > > > def allEntries : List[DBLogEntry] = ...
> >
> > > > > }
> >
> > > > > and we have some new event class/traits:
> >
> > > > > trait DBLogEntry {
> > > > > def statement : String
> > > > > def duration : Long}
> >
> > > > > object DBLogEntry {
> > > > > def unapply(obj : Any) = obj match {
> > > > > case entry : DBLogEntry => Some(entry.statement,entry.duration)
> > > > > case _ => None
> > > > > }}
> >
> > > > > case class DBStatementEntry(statement : String, duration : Long)
> > > extends
> > > > > DBLogEntry
> > > > > case class DBMetaEntry(statement : String, duration : Long) extends
> > > > > DBLogEntry
> >
> > > > > Statements are SQL statements, prepared or immediate, and meta
> entries
> > > > > correspond to things like getMaxRows, getGeneratedKeys, etc. As you
> can
> > > see,
> > > > > each individual statement records its own duration as well, so you
> can
> > > get
> > > > > fine-grained detail on all activity. An example log function in
> Boot
> > > could
> > > > > look like:
> >
> > > > > DB.addLogFunc{
> > > > > case (query, time) => {
> > > > > Log.info("All queries took " + time + "ms: ")
> > > > > query.allEntries.foreach({ case DBLogEntry(stmt, duration)
> =>
> > > > > Log.info(stmt + " took " + duration + "ms")})
> > > > > Log.info("End queries")
> > > > > }
> > > > > }
> >
> > > > > And we get output like:
> >
> > > > > INFO - All queries took 17ms:
> > > > > INFO - Exec update "INSERT INTO users
> >
> > >
> (lastname,locale,password_pw,password_slt,validated,uniqueid,timezone,firstname,email,superuser,textarea)
> > > > > VALUES
> >
> > >
> ("C","en_US","GzwLqDpmJ6TrECg06bGKvOAQxyc=","1JTAWGSSYLJHXASO",1,"DU0G0RT3IFOA0NHSY5QQQTX42BOIHDGI","US/Mountain","D","
> > > > > [email protected]",0,"")" : updated 1 rows took 9ms
> > > > > INFO - Get generated keys : rs =
> > > > > oracle.jdbc.driver.oraclereturnresult...@23f9e6e5 took 2ms
> > > > > INFO - Closed Statement took 0ms
> > > > > INFO - End queries
> >
> > > > > Note that this code does introduce a breaking change if you're
> already
> > > using
> > > > > log functions, since theaddLogFuncsignature has changed. If I can
> get a
> > > > > review on the code before I merge to master I would appreciate it.
> >
> > > > > Derek
> >
> > > > > On Sat, Aug 15, 2009 at 8:02 AM, Derek Chen-Becker <
> > > [email protected]>wrote:
> >
> > > > > > OK, a preliminary version of log wrappers is checked in on
> > > > > > wip-dcb-sql-log-wrappers. I'll merge it on Tuesday if no one sees
> any
> > > > > > problems with it.
> >
> > > > > > Derek
> >
> > > > > > On Tue, Aug 11, 2009 at 11:08 AM, Derek Chen-Becker <
> > > [email protected]
> > > > > > > wrote:
> >
> > > > > >> Will do.
> >
> > > > > >> On Tue, Aug 11, 2009 at 2:33 AM, marius d. <
> [email protected]
> > > >wrote:
> >
> > > > > >>> Please do so. If you need any help for some reason (time
> > > availability
> > > > > >>> etc.) please let me know. As a note probably the wrappers
> should be
> > > > > >>> only only when there is at least one log function registered.
> >
> > > > > >>> Br's,
> > > > > >>> Marius
> >
> > > > > >>> On Aug 6, 11:48 pm, Derek Chen-Becker <[email protected]>
> > > wrote:
> > > > > >>> > If there's a consensus that we want our own JDBC wrappers
> I'll go
> > > ahead
> > > > > >>> and
> > > > > >>> > write them.
> >
> > > > > >>> > Derek
> >
> > > > > >>> > On Thu, Aug 6, 2009 at 1:19 PM, marius d. <
> > > [email protected]>
> > > > > >>> wrote:
> >
> > > > > >>> > > Probably building our own wrappers would be more
> lightweight
> > > then
> > > > > >>> 3-rd
> > > > > >>> > > party. Jus' guessing
> >
> > > > > >>> > > Br's,
> > > > > >>> > > Marius
> >
> > > > > >>> > > On Aug 6, 9:58 pm, Derek Chen-Becker <
> [email protected]>
> > > wrote:
> > > > > >>> > > > Well, I started looking at it and determined that the
> only
> > > way for
> > > > > >>> us to
> > > > > >>> > > > truly log the queries would be to essentially make our
> own
> > > wrappers
> > > > > >>> over
> > > > > >>> > > > Statement and PreparedStatement. There are projects
> > > (log4jdbc,
> > > > > >>> notably)
> > > > > >>> > > that
> > > > > >>> > > > already do this, and in a transparent manner. I'm not
> sure
> > > that
> > > > > >>> adding a
> > > > > >>> > > > whole bunch of SQL logging directly to Lift is better
> than
> > > > > >>> leveraging
> > > > > >>> > > some
> > > > > >>> > > > existing libraries to do it.
> >
> > > > > >>> > > > Derek
> >
> > > > > >>> > > > On Thu, Aug 6, 2009 at 11:03 AM, marius d. <
> > > > > >>> [email protected]>
> > > > > >>> > > wrote:
> >
> > > > > >>> > > > > Yeah we're aware of that. That is based on toString
> > > application
> > > > > >>> which
> > > > > >>> > > > > is JDBC driver dependent. I think Derek started some
> work
> > > on this
> > > > > >>> to
> > > > > >>> > > > > correct this behavior. Derek ?
> >
> > > > > >>> > > > > Br's,
> > > > > >>> > > > > Marius
> >
> > > > > >>> > > > > On Aug 6, 8:01 pm, jon <[email protected]> wrote:
> > > > > >>> > > > > > Hi,
> >
> > > > > >>> > > > > > I have the following in boot:
> > > > > >>> > > > > > DB.addLogFunc((query, len) => Log.info("The query:
> > > "+query+"
> > > > > >>> took
> > > > > >>> > > > > > "+len+" milliseconds"))
> >
> > > > > >>> > > > > > I was expecting the query parameter to be sql, but
> it's
> > > > > >>> actually some
> > > > > >>> > > > > > sort of guid
> >
> > > > > >>> > > > > > "INFO - The query:
> 6839c016-0122-f09a-9c96-0000003844e8
> > > took 5
> > > > > >>> > > > > > milliseconds"
> >
> > > > > >>> > > > > > Any ideas?
> > > > > >>> > > > > > I'm running with derby.
> >
> > > > > >>> > > > > > Thanks,
> >
> > > > > >>> > > > > > Jon
> >
>
--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---