Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorislav Kapukaranov2012-10-04 08:05:27 -0400
committerBorislav Kapukaranov2012-10-04 08:05:27 -0400
commitc2b09be96befa77a191811b4aa530658a276f85f (patch)
tree86e80024d3f61345e6dbb15e795a5379546e743d
parent2cbeb5f64b1006cedbadb68dd8224ed1e1261a9b (diff)
downloadorg.eclipse.virgo.medic-c2b09be96befa77a191811b4aa530658a276f85f.tar.gz
org.eclipse.virgo.medic-c2b09be96befa77a191811b4aa530658a276f85f.tar.xz
org.eclipse.virgo.medic-c2b09be96befa77a191811b4aa530658a276f85f.zip
391107 - Adds a warning message related to a stricter property value checks.
-rwxr-xr-xorg.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/LogController.java38
-rw-r--r--org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/config/ConfigurationAdminConfigurationProvider.java9
2 files changed, 24 insertions, 23 deletions
diff --git a/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/LogController.java b/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/LogController.java
index 15632e6..47bf8a6 100755
--- a/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/LogController.java
+++ b/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/LogController.java
@@ -283,18 +283,14 @@ public class LogController implements ConfigurationChangeListener {
}
private synchronized void updateLogConfiguration(Dictionary<String, Object> configuration) {
- if (Boolean.valueOf((String)configuration.get(ConfigurationProvider.KEY_LOG_WRAP_SYSOUT))) {
+ String logSysOutConfiguration = (String)configuration.get(ConfigurationProvider.KEY_LOG_WRAP_SYSOUT);
+ if (Boolean.valueOf(logSysOutConfiguration)) {
delegatingSysOutRegistration = publishDelegatingPrintStream(delegatingSysOut, LOGGER_NAME_SYSOUT_DELEGATE);
sysOutRegistration = publishPrintStream(this.sysOut, LOGGER_NAME_SYSOUT);
System.setOut(wrapPrintStream(System.out, LOGGER_NAME_SYSOUT, LoggingLevel.INFO, stackAccessor, configurationProvider, ConfigurationProvider.KEY_LOG_WRAP_SYSOUT));
} else {
- if (ConfigurationProvider.LOG_TEE_SYSSTREAMS.equals((String)configuration.get(ConfigurationProvider.KEY_LOG_WRAP_SYSOUT))) {
- delegatingSysOutRegistration = publishDelegatingPrintStream(delegatingSysOut, LOGGER_NAME_SYSOUT_DELEGATE);
- sysOutRegistration = publishPrintStream(this.sysOut, LOGGER_NAME_SYSOUT);
-
- System.setOut(decoratePrintStream(System.out, LOGGER_NAME_SYSOUT, LoggingLevel.INFO, stackAccessor, configurationProvider, ConfigurationProvider.KEY_LOG_WRAP_SYSOUT));
- } else {
+ if (Boolean.FALSE.toString().equals(logSysOutConfiguration)) {
if (delegatingSysOutRegistration != null) {
registrationTracker.unregister(delegatingSysOutRegistration);
delegatingSysOutRegistration = null;
@@ -304,21 +300,26 @@ public class LogController implements ConfigurationChangeListener {
sysOutRegistration = null;
}
System.setOut((PrintStream) delegatingSysOut);
+ } else {
+ delegatingSysOutRegistration = publishDelegatingPrintStream(delegatingSysOut, LOGGER_NAME_SYSOUT_DELEGATE);
+ sysOutRegistration = publishPrintStream(this.sysOut, LOGGER_NAME_SYSOUT);
+
+ System.setOut(decoratePrintStream(System.out, LOGGER_NAME_SYSOUT, LoggingLevel.INFO, stackAccessor, configurationProvider, ConfigurationProvider.KEY_LOG_WRAP_SYSOUT));
+
+ if (!ConfigurationProvider.LOG_TEE_SYSSTREAMS.equals(logSysOutConfiguration)) {
+ System.out.println("Invalid value '" + logSysOutConfiguration + "' for configuration key '" + ConfigurationProvider.KEY_LOG_WRAP_SYSOUT + "'. Valid values are 'true | tee | false'. Defaulted to 'tee'.");
+ }
}
}
- if (Boolean.valueOf((String)configuration.get(ConfigurationProvider.KEY_LOG_WRAP_SYSERR))) {
+ String logSysErrConfiguration = (String)configuration.get(ConfigurationProvider.KEY_LOG_WRAP_SYSERR);
+ if (Boolean.valueOf(logSysErrConfiguration)) {
delegatingSysErrRegistration = publishDelegatingPrintStream(delegatingSysErr, LOGGER_NAME_SYSERR_DELEGATE);
sysErrRegistration = publishPrintStream(this.sysErr, LOGGER_NAME_SYSERR);
System.setErr(wrapPrintStream(System.err, LOGGER_NAME_SYSERR, LoggingLevel.ERROR, stackAccessor, configurationProvider, ConfigurationProvider.KEY_LOG_WRAP_SYSERR));
} else {
- if (ConfigurationProvider.LOG_TEE_SYSSTREAMS.equals((String)configuration.get(ConfigurationProvider.KEY_LOG_WRAP_SYSOUT))) {
- delegatingSysErrRegistration = publishDelegatingPrintStream(delegatingSysErr, LOGGER_NAME_SYSERR_DELEGATE);
- sysErrRegistration = publishPrintStream(this.sysErr, LOGGER_NAME_SYSERR);
-
- System.setErr(decoratePrintStream(System.err, LOGGER_NAME_SYSERR, LoggingLevel.ERROR, stackAccessor, configurationProvider, ConfigurationProvider.KEY_LOG_WRAP_SYSERR));
- } else {
+ if (Boolean.FALSE.toString().equals(logSysErrConfiguration)) {
if (delegatingSysErrRegistration != null) {
registrationTracker.unregister(delegatingSysErrRegistration);
delegatingSysErrRegistration = null;
@@ -328,6 +329,15 @@ public class LogController implements ConfigurationChangeListener {
sysErrRegistration = null;
}
System.setErr((PrintStream) delegatingSysErr);
+ } else {
+ delegatingSysErrRegistration = publishDelegatingPrintStream(delegatingSysErr, LOGGER_NAME_SYSERR_DELEGATE);
+ sysErrRegistration = publishPrintStream(this.sysErr, LOGGER_NAME_SYSERR);
+
+ System.setErr(decoratePrintStream(System.err, LOGGER_NAME_SYSERR, LoggingLevel.ERROR, stackAccessor, configurationProvider, ConfigurationProvider.KEY_LOG_WRAP_SYSERR));
+
+ if (!ConfigurationProvider.LOG_TEE_SYSSTREAMS.equals(logSysErrConfiguration)) {
+ System.err.println("Invalid value '" + logSysErrConfiguration + "' for configuration key '" + ConfigurationProvider.KEY_LOG_WRAP_SYSERR + "'. Valid values are 'true | tee | false'. Defaulted to 'tee'.");
+ }
}
}
diff --git a/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/config/ConfigurationAdminConfigurationProvider.java b/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/config/ConfigurationAdminConfigurationProvider.java
index a3fbdfe..f3c4559 100644
--- a/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/config/ConfigurationAdminConfigurationProvider.java
+++ b/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/config/ConfigurationAdminConfigurationProvider.java
@@ -25,8 +25,6 @@ import org.osgi.service.cm.ConfigurationListener;
public final class ConfigurationAdminConfigurationProvider implements ConfigurationProvider, ConfigurationListener {
- private static final String TEE_MODE = ConfigurationProvider.LOG_TEE_SYSSTREAMS;
-
private static final String CONFIG_ADMIN_PID = "org.eclipse.virgo.medic";
private static final Dictionary<String, Object> DEFAULT_CONFIG = createDefaultConfiguration();
@@ -86,15 +84,8 @@ public final class ConfigurationAdminConfigurationProvider implements Configurat
private static Dictionary<String, Object> createDefaultConfiguration() {
Dictionary<String, Object> configuration = new Hashtable<String, Object>();
configuration.put(KEY_DUMP_ROOT_DIRECTORY, ".");
-
- String defaultConfiguration = System.getProperty("org.eclipse.virgo.default.log.wrapSystemStreams");
- if (defaultConfiguration != null && !defaultConfiguration.isEmpty() && defaultConfiguration.equals(TEE_MODE)) {
- configuration.put(KEY_LOG_WRAP_SYSOUT, TEE_MODE);
- configuration.put(KEY_LOG_WRAP_SYSERR, TEE_MODE);
- } else {
configuration.put(KEY_LOG_WRAP_SYSOUT, Boolean.toString(Boolean.TRUE));
configuration.put(KEY_LOG_WRAP_SYSERR, Boolean.toString(Boolean.TRUE));
- }
return configuration;
}

Back to the top