[java-metadata-aggregator] branch main updated: MDA-256 - Move logging configurations into package-specific resources
Ian Young
ian at iay.org.uk
Wed Sep 9 15:48:27 UTC 2020
This is an automated email from the git hooks/post-receive script.
iay pushed a commit to branch main
in repository java-metadata-aggregator.
View the commit online:
http://git.shibboleth.net/view/?p=java-metadata-aggregator.git;a=commit;h=aa5a192a71b83e280edb4af7813107c0ebebd6f7
The following commit(s) were added to refs/heads/main by this push:
new aa5a192 MDA-256 - Move logging configurations into package-specific resources
aa5a192 is described below
commit aa5a192a71b83e280edb4af7813107c0ebebd6f7
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Wed Sep 9 15:43:28 2020 +0100
MDA-256 - Move logging configurations into package-specific resources
https://issues.shibboleth.net/jira/browse/MDA-256
---
.../shibboleth/metadata/cli/SimpleCommandLine.java | 35 ++++++++++++++++++----
.../shibboleth/metadata/cli}/logger-normal.xml | 0
.../shibboleth/metadata/cli}/logger-quiet.xml | 0
.../shibboleth/metadata/cli}/logger-verbose.xml | 0
4 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/aggregator-cli/src/main/java/net/shibboleth/metadata/cli/SimpleCommandLine.java b/aggregator-cli/src/main/java/net/shibboleth/metadata/cli/SimpleCommandLine.java
index d99ced5..9f78062 100644
--- a/aggregator-cli/src/main/java/net/shibboleth/metadata/cli/SimpleCommandLine.java
+++ b/aggregator-cli/src/main/java/net/shibboleth/metadata/cli/SimpleCommandLine.java
@@ -21,6 +21,8 @@ import java.io.File;
import java.util.ArrayList;
import java.util.Date;
+import javax.annotation.Nonnull;
+
import net.shibboleth.metadata.Item;
import net.shibboleth.metadata.Version;
import net.shibboleth.metadata.pipeline.Pipeline;
@@ -147,6 +149,29 @@ public final class SimpleCommandLine {
}
}
+ /**
+ * Set the logback configuration to a specific location.
+ *
+ * <p>
+ * Note that this <strong>must</strong> be done before the
+ * first logger is retrieved.
+ * </p>
+ *
+ * @param value logback configuration location to set
+ */
+ private static void setLoggingProperty(@Nonnull final String value) {
+ System.setProperty("logback.configurationFile", value);
+ }
+
+ /**
+ * Set the logback configuration to a specific package-local resource.
+ *
+ * @param value name of resource to use as the logback configuration file
+ */
+ private static void setLoggingToLocalResource(@Nonnull final String value) {
+ setLoggingProperty("net/shibboleth/metadata/cli/" + value);
+ }
+
/**
* Initialize the logging subsystem.
*
@@ -154,15 +179,15 @@ public final class SimpleCommandLine {
*/
protected static void initLogging(final SimpleCommandLineArguments cli) {
if (cli.getLoggingConfiguration() != null) {
- System.setProperty("logback.configurationFile", cli.getLoggingConfiguration());
+ setLoggingProperty(cli.getLoggingConfiguration());
} else if (cli.doVerboseOutput()) {
- System.setProperty("logback.configurationFile", "logger-verbose.xml");
+ setLoggingToLocalResource("logger-verbose.xml");
} else if (cli.doQuietOutput()) {
- System.setProperty("logback.configurationFile", "logger-quiet.xml");
+ setLoggingToLocalResource("logger-quiet.xml");
} else {
- System.setProperty("logback.configurationFile", "logger-normal.xml");
+ setLoggingToLocalResource("logger-normal.xml");
}
log = LoggerFactory.getLogger(SimpleCommandLine.class);
}
-}
\ No newline at end of file
+}
diff --git a/aggregator-cli/src/main/resources/logger-normal.xml b/aggregator-cli/src/main/resources/net/shibboleth/metadata/cli/logger-normal.xml
similarity index 100%
rename from aggregator-cli/src/main/resources/logger-normal.xml
rename to aggregator-cli/src/main/resources/net/shibboleth/metadata/cli/logger-normal.xml
diff --git a/aggregator-cli/src/main/resources/logger-quiet.xml b/aggregator-cli/src/main/resources/net/shibboleth/metadata/cli/logger-quiet.xml
similarity index 100%
rename from aggregator-cli/src/main/resources/logger-quiet.xml
rename to aggregator-cli/src/main/resources/net/shibboleth/metadata/cli/logger-quiet.xml
diff --git a/aggregator-cli/src/main/resources/logger-verbose.xml b/aggregator-cli/src/main/resources/net/shibboleth/metadata/cli/logger-verbose.xml
similarity index 100%
rename from aggregator-cli/src/main/resources/logger-verbose.xml
rename to aggregator-cli/src/main/resources/net/shibboleth/metadata/cli/logger-verbose.xml
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list