3

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.

digiplant
  • 273
  • 1
  • 10
  • Hi. I have the same problem. Have you found a solution? – Julien Poulin Jan 22 '18 at 07:01
  • I did not. I tried several different configurations in the EMR settings, but did not get this to work. It seemed like my logging settings were being superseded by the environment's configuration. I would suggest investigating those settings further. – digiplant Jan 23 '18 at 20:19
  • Thanks. In the end, I gave up on scala-logging and used log4j2 instead. – Julien Poulin Jan 29 '18 at 14:01

0 Answers0