Uploaded image for project: 'Tika'
  1. Tika
  2. TIKA-3568

Tika CLI tightly coupled to Log4J2

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.2.0
    • None
    • app
    • None

    Description

      https://github.com/apache/tika/blob/7b167915bfcdc015f5e9afc35b3050bca9c1e1c8/tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java#L383 

      TikaCLI directly invokes a Log4J2 API to set the log level when it should be setting the log level using SLF4J, something like ...

      System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "DEBUG");
      

      This tightly couples the CLI to Log4J2 and makes it hard to use another logging framework that may differ in any ingesting app.

      Moreover, the implication of this ticket is that perhaps Log4J2 should be removed from the CLI, especially since it is only logging to `CONSOLE`. SLF4J's SimpleLogger logs to stdout by default and can be easily replaced with a different logging mechanism. 

      Since Log4J2 doesn't refresh default logging levels between calls and after instantiation (as I understand), setting a System Property probably won't work for Log4J2, but it does work for SLF4Js SimpleLogger.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jpl-jengelke John Engelke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: