This is an automated email from the ASF dual-hosted git repository.

tallison pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tika.git


The following commit(s) were added to refs/heads/main by this push:
     new e194de79b Improve debug logging in TikaConfig
     new 5832eb854 Merge remote-tracking branch 'origin/main' into main
e194de79b is described below

commit e194de79b32d34227b4c54bba5fc4e770a5df2a4
Author: tballison <[email protected]>
AuthorDate: Fri Jul 15 12:28:59 2022 -0400

    Improve debug logging in TikaConfig
---
 tika-core/src/main/java/org/apache/tika/config/TikaConfig.java | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tika-core/src/main/java/org/apache/tika/config/TikaConfig.java 
b/tika-core/src/main/java/org/apache/tika/config/TikaConfig.java
index e7c212f87..cb23cec21 100644
--- a/tika-core/src/main/java/org/apache/tika/config/TikaConfig.java
+++ b/tika-core/src/main/java/org/apache/tika/config/TikaConfig.java
@@ -79,6 +79,7 @@ import org.apache.tika.parser.multiple.AbstractMultipleParser;
 import org.apache.tika.renderer.CompositeRenderer;
 import org.apache.tika.renderer.Renderer;
 import org.apache.tika.utils.AnnotationUtils;
+import org.apache.tika.utils.StringUtils;
 import org.apache.tika.utils.XMLReaderUtils;
 
 /**
@@ -222,11 +223,19 @@ public class TikaConfig {
     public TikaConfig() throws TikaException, IOException {
 
         String config = System.getProperty("tika.config");
+        if (!StringUtils.isBlank(config)) {
+            LOG.debug("loading tika config from system property 
'tika.config'");
+        }
+
         if (config == null || config.trim().equals("")) {
             config = System.getenv("TIKA_CONFIG");
+            if (!StringUtils.isBlank(config)) {
+                LOG.debug("loading tika config from environment variable 
'TIKA_CONFIG'");
+            }
         }
 
         if (config == null || config.trim().equals("")) {
+            LOG.debug("loading tika config from defaults; no config file 
specified");
             this.serviceLoader = new ServiceLoader();
             this.mimeTypes = getDefaultMimeTypes(getContextClassLoader());
             this.encodingDetector = getDefaultEncodingDetector(serviceLoader);
@@ -239,6 +248,7 @@ public class TikaConfig {
             this.autoDetectParserConfig = AutoDetectParserConfig.DEFAULT;
         } else {
             ServiceLoader tmpServiceLoader = new ServiceLoader();
+            LOG.debug("loading tika config from: " + config);
             try (InputStream stream = getConfigInputStream(config, 
tmpServiceLoader)) {
                 Element element = 
XMLReaderUtils.buildDOM(stream).getDocumentElement();
                 updateXMLReaderUtils(element);

Reply via email to