Clément MATHIEU created AVRO-1960:
-------------------------------------
Summary: avro-tools should not display log4j warning when started
with java -jar
Key: AVRO-1960
URL: https://issues.apache.org/jira/browse/AVRO-1960
Project: Avro
Issue Type: Improvement
Components: java
Affects Versions: 1.8.1
Reporter: Clément MATHIEU
When started as a regular java application, ie. java -jar, avro-tools displays
an annoying log4j warning:
{noformat}
$ java -jar target/avro-tools-1.9.0-SNAPSHOT.jar tojson
./target/mapred/in/lines.avro/
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.
{noformat}
log4j should be properly initialized in the two supported execution contexts:
regular jar & hadoop jar.
When run as a regular jar, log4j looks for a {{log4j.properties}} or
{{log4j.xml}} in the classpath and displays the aforementioned warning message
if none is found. IMHO, we should provide a default configuration file. User
will still be able to override the log4j configuration using
{{-Dlog4j.configuration}}.
When run with {{hadoop jar}}, {{hadoop-config.sh}} puts {{HADOOP_CONF_DIR}}
first in the classpath. Since {{HADOOP_CONF_DIR}} contains a
{{log4j.properties}}, the one provided by avro-tools won't be used, which seems
fine. Here again, users can use {{-Dlog4j.configuration}} if they need.
What do you think of adding a simple log4j.properties file into
src/main/resources ? What would be a good default log4j configuration ?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)