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

John Engelke updated TIKA-3568:
-------------------------------
    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 ...
{code:java}
System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "DEBUG");
{code}
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.

  was:
[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 ...
{code:java}
System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "DEBUG");
{code}
This tightly couples the CLI to Log4J2 and makes it hard to use another logging 
framework.


> Tika CLI tightly coupled to Log4J2
> ----------------------------------
>
>                 Key: TIKA-3568
>                 URL: https://issues.apache.org/jira/browse/TIKA-3568
>             Project: Tika
>          Issue Type: Bug
>          Components: app
>    Affects Versions: 2.1.1
>            Reporter: John Engelke
>            Priority: Major
>
> [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 ...
> {code:java}
> System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, 
> "DEBUG");
> {code}
> 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to