[spring-extensions] branch main updated: JSE-41 - Move logging configurations into package-specific resources
Ian Young
ian at iay.org.uk
Wed Sep 9 19:07:52 UTC 2020
This is an automated email from the git hooks/post-receive script.
iay pushed a commit to branch main
in repository spring-extensions.
View the commit online:
http://git.shibboleth.net/view/?p=spring-extensions.git;a=commit;h=4edd6fe8d3a705e172639168bb4c265154e6a917
The following commit(s) were added to refs/heads/main by this push:
new 4edd6fe JSE-41 - Move logging configurations into package-specific resources
4edd6fe is described below
commit 4edd6fe8d3a705e172639168bb4c265154e6a917
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Wed Sep 9 20:07:49 2020 +0100
JSE-41 - Move logging configurations into package-specific resources
https://issues.shibboleth.net/jira/browse/JSE-41
---
.../ext/spring/cli/AbstractCommandLine.java | 31 +++++++++++++++++++---
.../shibboleth/ext/spring/cli}/logger-normal.xml | 0
.../shibboleth/ext/spring/cli}/logger-quiet.xml | 0
.../shibboleth/ext/spring/cli}/logger-verbose.xml | 0
4 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/src/main/java/net/shibboleth/ext/spring/cli/AbstractCommandLine.java b/src/main/java/net/shibboleth/ext/spring/cli/AbstractCommandLine.java
index 3112d3f..9750967 100644
--- a/src/main/java/net/shibboleth/ext/spring/cli/AbstractCommandLine.java
+++ b/src/main/java/net/shibboleth/ext/spring/cli/AbstractCommandLine.java
@@ -196,6 +196,29 @@ public abstract class AbstractCommandLine<T extends CommandLineArguments> {
return doRun(argObject);
}
+ /**
+ * 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 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 void setLoggingToLocalResource(@Nonnull final String value) {
+ setLoggingProperty("net/shibboleth/ext/spring/cli/" + value);
+ }
+
/**
* Initialize the logging subsystem.
*
@@ -203,13 +226,13 @@ public abstract class AbstractCommandLine<T extends CommandLineArguments> {
*/
protected void initLogging(@Nonnull final T args) {
if (args.getLoggingConfiguration() != null) {
- System.setProperty("logback.configurationFile", args.getLoggingConfiguration());
+ setLoggingProperty(args.getLoggingConfiguration());
} else if (args.isVerboseOutput()) {
- System.setProperty("logback.configurationFile", "logger-verbose.xml");
+ setLoggingToLocalResource("logger-verbose.xml");
} else if (args.isQuietOutput()) {
- System.setProperty("logback.configurationFile", "logger-quiet.xml");
+ setLoggingToLocalResource("logger-quiet.xml");
} else {
- System.setProperty("logback.configurationFile", "logger-normal.xml");
+ setLoggingToLocalResource("logger-normal.xml");
}
}
diff --git a/src/main/resources/logger-normal.xml b/src/main/resources/net/shibboleth/ext/spring/cli/logger-normal.xml
similarity index 100%
rename from src/main/resources/logger-normal.xml
rename to src/main/resources/net/shibboleth/ext/spring/cli/logger-normal.xml
diff --git a/src/main/resources/logger-quiet.xml b/src/main/resources/net/shibboleth/ext/spring/cli/logger-quiet.xml
similarity index 100%
rename from src/main/resources/logger-quiet.xml
rename to src/main/resources/net/shibboleth/ext/spring/cli/logger-quiet.xml
diff --git a/src/main/resources/logger-verbose.xml b/src/main/resources/net/shibboleth/ext/spring/cli/logger-verbose.xml
similarity index 100%
rename from src/main/resources/logger-verbose.xml
rename to src/main/resources/net/shibboleth/ext/spring/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