I have a piece of code in Scala which uses log4j to do logging.
I have a few conditions upon which I want to log some information to the stderr/stdout of the EMR.
If I have a non-zero exit code it will log it:
if (args.length != 2) {
log.setLevel(Level.ERROR)
log.error("Expecting 2 args. Usage: ...")
System.exit(4)
}
However if I just have regular logging it does not show:
log.setLevel(Level.INFO)
log.info("This is my log")
I thought that perhaps this was because it only logs the errors in the EMR and tried the following:
log.setLevel(Level.ERROR)
log.error("This is my log")
With no luck.
It seems the logs are only written with a non-zero exit code.
I believe they are probably writing somewhere outside the log file. Is there any way to make it so that they do write where I am expecting them too?