I have a scala spark application where I am trying to log the start of specific events to a file. Application looks like this:
package com.myApp
import org.apache.logging.log4j.scala.{Logger, Logging}
object someSpark extends Logging {
def main(args:Array[String] {
logger.info("The application has started")
//Do some Spark stuff here//
logger.info("The application has ended")
}
}
I have an appender set up in my log4j properties file like this:
log4j.appender.appAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.appAppender.File=./logs/appLog.log
log4j.appender.appAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.appAppender.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
and also have this line:
log4j.logger.com.myApp=ALL, appAppender
As I understand it, this should run any log messages written when executing code in com.myApp to the file ./logs/appLog.log, however, nothing actually gets written there, just an empty file. The messages do show up in the mysterious file in that same location called app.log. I have no idea what is causing that file to be generated nor how I can control what the output looks like. Any insight into what I am doing wrong is appreciated. Also, let me know what other info I can provide.
Thanks.