Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-1960

avro-tools should not display log4j warning when started with java -jar

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.8.1
    • 1.9.0
    • java
    • None

    Description

      When started as a regular java application, ie. java -jar, avro-tools displays an annoying log4j warning:

      $ 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.
      

      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 ?

      Attachments

        1. AVRO-1960.patch
          0.5 kB
          Clément MATHIEU

        Activity

          People

            clement@unportant.info Clément MATHIEU
            clement@unportant.info Clément MATHIEU
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: