I am using scala-logging with a logback.xml configuration file to send log messages to the console, but they do not appear. My code is running on an Amazon-EMR cluster and my code is called using spark-sumbit.
My build.sbt file contains the dependencies:
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.1.7"
libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.5.0"
My src/main/resources/logback.xml contains:
<configuration>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="debug">
<appender-ref ref="console"/>
</root>
</configuration>
I am logging from a method in a class that resembles:
import com.typesafe.scalalogging.LazyLogging
class MyClass() extends LazyLogging {
def myMethod() = {
logger.debug("debug logging test")
logger.info("info logging test")
logger.warn("warn logging test")
logger.error("error logging test")
println("This message appears in console")
}
}
None of the messages at any log level appear. Note that when I use println method, the messages appear in the console/stdout.