From bb91ad6d4b363b4f1a9d7f011f342e8fb3694ddc Mon Sep 17 00:00:00 2001 From: Craig Macdonald Date: Thu, 22 Aug 2024 12:05:44 +0100 Subject: [PATCH] suppress No etc/terrier.properties message --- .../main/java/org/terrier/utility/ApplicationSetup.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/core/src/main/java/org/terrier/utility/ApplicationSetup.java b/modules/core/src/main/java/org/terrier/utility/ApplicationSetup.java index 5865c3b6..f334e632 100644 --- a/modules/core/src/main/java/org/terrier/utility/ApplicationSetup.java +++ b/modules/core/src/main/java/org/terrier/utility/ApplicationSetup.java @@ -314,6 +314,8 @@ public interface TerrierApplicationPlugin public static void bootstrapInitialisation() { useContext = Boolean.parseBoolean(System.getProperty("terrier.usecontext", "false")); + // we dont have a logger configured at this stage, so we can use this System property + boolean debug = Boolean.parseBoolean(System.getProperty("terrier.debug.config", "false")); String propertiesFile = null; String terrier_home = null; @@ -346,13 +348,14 @@ public static void bootstrapInitialisation() else //we will need to hunt for the terrier.properties file { terrier_home = System.getProperty("terrier.home", "."); - terrier_etc = System.getProperty("terrier.etc", terrier_home +FILE_SEPARATOR+"etc"); propertiesFile = System.getProperty("terrier.setup", terrier_etc + FILE_SEPARATOR+"terrier.properties"); } if (new File(propertiesFile).exists()) { + if (debug) + System.err.println("Using terrier.properties file at" + propertiesFile + " for configuration"); clearAllProperties(); TERRIER_HOME = getProperty("terrier.home", terrier_home); FileInputStream in = new FileInputStream(propertiesFile); @@ -364,7 +367,8 @@ public static void bootstrapInitialisation() terrier_etc = System.getProperty("terrier.etc", "."); ClassLoader clz = ApplicationSetup.class.getClassLoader(); List resources = loadResources("terrier.default.properties", clz); - System.err.println("No etc/terrier.properties, using terrier.default.properties for bootstrap configuration."); + if (debug) + System.err.println("No etc/terrier.properties, using terrier.default.properties for bootstrap configuration."); configure(resources.toArray(new InputStream[0])); for(InputStream in : resources) { in.close();