I\'m trying to use Typesafe\'s Scala Logging but couldn\'t get it to print any debug message. I expect Scala Logging to print debug message to the default screen but it does
You're close, but you have to declare a logger
instance using an SLF4J logger in the apply
method for the Logger
companion in com.typesafe.scalalogging
. In your build.sbt
include:
libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.1.0"
libraryDependencies += "org.slf4j" % "slf4j-api" % "1.7.10"
Then this will work:
import com.typesafe.scalalogging._
import org.slf4j.LoggerFactory
class MyClass extends LazyLogging {
// ...
val logger = Logger(LoggerFactory.getLogger(this.getClass))
logger.debug("Here goes my debug message.")
// ...
}
Here is a reference for LoggerFactory. Hope it helps!