Reputation: 11
enter image description hereI am new to scala and I am doing some basic programs. I am trying to add the Scala Logging library by adding the following library dependencies in build.sbt:
"ch.qos.logback" % "logback-classic" % "1.1.7"
"com.typesafe.scala-logging" %% "scala-logging" % "3.4.0"
But the logging libraries are not getting downloaded and present under external libraries.
The program I am working with is
package com.allaboutscala.chapter.one.tutorial_10
object HelloWorldWithScalaLogging extends App with LazyLogging{
logger.info("hello from logger")
}
Please find the screenshot attached.
It would be great if someone can guide me on this issue.
Upvotes: 0
Views: 1353
Reputation: 320
The issue with the versions, we're importing. Try this code
libraryDependencies ++= Seq(
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.3",
"ch.qos.logback" % "logback-classic" % "1.2.3"
)
Here is the more info about this dependency: About Scala Logging
Here is the code snippt:
package hello
import com.typesafe.scalalogging.{LazyLogging, Logger}
object Hello extends App with LazyLogging{
println("Programming is a fun");
lazy override val logger = Logger("name");
logger.info("hello Bug");
}
Upvotes: 3