Configuring Apache Spark Logging with Scala and logback

后端 未结 2 878
一生所求
一生所求 2020-12-10 17:11

I am very confused with setting up logging with Apache Spark. Apache spark used Log4j for logging and it generates huge amount of log data. Is there a way to setup log4j fo

2条回答
  •  情书的邮戳
    2020-12-10 17:49

    I have used the following imports:

    import org.slf4j.Logger
    import org.slf4j.LoggerFactory
    

    Sample code as shown below.

    Object SparkCode {
    
    val logger = LoggerFactory.getLogger(this.getClass.getName)
    
      def main(args: Array[String]) {
    
      logger.info("Connection Started . ")
    
      // Create Spark Context and go on..
    
      }
    
    }
    

    And you are sorted.

提交回复
热议问题