aw anth...@whitford.com writes:
I am using SLF4J logging, but I am not sure if I am doing it the
right way...
I have pointed Lift to use SLF4J, and I call the enable routine and
have updated dependencies. All of that seems fine.
My question is around, how do my classes best use it... For example,
I am generally doing something like:
import org.slf4j.{Logger, LoggerFactory}
class Foo {
private val LOGGER = LoggerFactory.getLogger(getClass)
...
}
Is this what one would expect? Or is there a Lift Way that
obsoletes the above?
I suggest using Lift's Logger (it can be configured to use slf4j,
search the archives for details). It has the nice feature that the log
message is lazily evaluated, so you don't have to litter your code with
if(log.isDebugEnabled) log.debug(...)
Also, I create a trait:
trait Logging {
val log = LogBoot.loggerByName(this.getClass.getName)
}
This makes it easy to have logging in a class:
class myclass extends MyParent with Logging {
log.debug(logggin stuff)
}
/Jeppe
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---