You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Suraj Acharya (JIRA)" <ji...@apache.org> on 2017/02/09 03:20:41 UTC

[jira] [Resolved] (AVRO-1960) avro-tools should not display log4j warning when started with java -jar

     [ https://issues.apache.org/jira/browse/AVRO-1960?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Suraj Acharya resolved AVRO-1960.
---------------------------------
       Resolution: Fixed
         Assignee: Clément MATHIEU
    Fix Version/s: 1.9.0

> 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
>            Assignee: Clément MATHIEU
>             Fix For: 1.9.0
>
>         Attachments: AVRO-1960.patch
>
>
> 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.15#6346)