I am using a package (ravro) that in turn uses rJava to call out to the Avro Java library to do its work. That library uses log4j for logging and when I use one of the functions from ravro I get the missing log4j config messages:
log4j:WARN No appenders could be found for logger (org.apache.hadoop.metrics2.lib.MutableMetricsFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
I know that to get rid of these message I just need to create a minimum log4j.properties file and put it on the classpath. The question is how to do this in R? I did try to use .jaddclassPath
, with the directory containing the log4j.properties
file but that didn't seem to work.
If you are using ravro in an analysis context, I have had luck with placing the
log4j.properties
in the work directory and adding that to the classPath withrJava::.jinit(getwd())
. You can check and make sure that the directory is added withrJava::.jclassPath()
.In a package development context, I copied rJavaPackageExample and appended
rJava::.jaddClassPath(file.path(getwd(), "inst/java"))
at the end of.onLoad
.