summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
authorAlex Rudyy <orudyy@apache.org>2014-12-10 17:34:03 +0000
committerAlex Rudyy <orudyy@apache.org>2014-12-10 17:34:03 +0000
commit71ddec5d6e828d3078a3782ab81955a538d22762 (patch)
treecc6e5acaa32c6cd7149ca22a26cc4d22d2851622 /qpid/java
parentb1e8d83ef545719e5a39d50726d977b5f747a245 (diff)
downloadqpid-python-71ddec5d6e828d3078a3782ab81955a538d22762.tar.gz
QPID-6265: Allow suppression of system out operational logging in broker starter class
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1644491 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/Broker.java21
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/BrokerOptions.java18
2 files changed, 34 insertions, 5 deletions
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/Broker.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/Broker.java
index e187b32694..c18923ffe0 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/Broker.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/Broker.java
@@ -150,19 +150,29 @@ public class Broker implements BrokerShutdownProvider
String storeLocation = options.getConfigurationStoreLocation();
String storeType = options.getConfigurationStoreType();
- _eventLogger.message(BrokerMessages.CONFIG(storeLocation));
+ if (options.isStartupLoggedToSystemOut())
+ {
+ _eventLogger.message(BrokerMessages.CONFIG(storeLocation));
+ }
//Allow skipping the logging configuration for people who are
//embedding the broker and want to configure it themselves.
if(!options.isSkipLoggingConfiguration())
{
- configureLogging(new File(options.getLogConfigFileLocation()), options.getLogWatchFrequency());
+ configureLogging(new File(options.getLogConfigFileLocation()), options.getLogWatchFrequency(), options.isStartupLoggedToSystemOut());
}
// Create the RootLogger to be used during broker operation
boolean statusUpdatesEnabled = Boolean.parseBoolean(System.getProperty(BrokerProperties.PROPERTY_STATUS_UPDATES, "true"));
MessageLogger messageLogger = new Log4jMessageLogger(statusUpdatesEnabled);
_eventLogger.setMessageLogger(messageLogger);
+ // Additionally, report BRK-1006 and BRK-1007 into log4j appenders
+ if(!options.isSkipLoggingConfiguration())
+ {
+ _eventLogger.message(BrokerMessages.LOG_CONFIG(new File(options.getLogConfigFileLocation()).getAbsolutePath()));
+ }
+
+ _eventLogger.message(BrokerMessages.CONFIG(storeLocation));
PluggableFactoryLoader<SystemConfigFactory> configFactoryLoader = new PluggableFactoryLoader<>(SystemConfigFactory.class);
SystemConfigFactory configFactory = configFactoryLoader.get(storeType);
@@ -198,12 +208,15 @@ public class Broker implements BrokerShutdownProvider
}
- private void configureLogging(File logConfigFile, int logWatchTime) throws InitException, IOException
+ private void configureLogging(File logConfigFile, int logWatchTime, boolean startupLoggedToSystemOutput) throws InitException, IOException
{
_configuringOwnLogging = true;
if (logConfigFile.exists() && logConfigFile.canRead())
{
- _eventLogger.message(BrokerMessages.LOG_CONFIG(logConfigFile.getAbsolutePath()));
+ if (startupLoggedToSystemOutput)
+ {
+ _eventLogger.message(BrokerMessages.LOG_CONFIG(logConfigFile.getAbsolutePath()));
+ }
if (logWatchTime > 0)
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/BrokerOptions.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/BrokerOptions.java
index ebb113d43b..c7cceb3913 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/BrokerOptions.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/BrokerOptions.java
@@ -80,6 +80,7 @@ public class BrokerOptions
private boolean _overwriteConfigurationStore;
private Map<String, String> _configProperties = new HashMap<String,String>();
private String _initialSystemProperties;
+ private boolean _startupLoggedToSystemOut = true;
public Map<String, Object> convertToSystemConfigAttributes()
{
@@ -95,7 +96,7 @@ public class BrokerOptions
attributes.put(SystemConfig.MANAGEMENT_MODE_HTTP_PORT_OVERRIDE, _managementModeHttpPortOverride);
attributes.put(SystemConfig.MANAGEMENT_MODE_PASSWORD, _managementModePassword);
attributes.put(SystemConfig.INITIAL_CONFIGURATION_LOCATION, getInitialConfigurationLocation());
-
+ attributes.put(SystemConfig.STARTUP_LOGGED_TO_SYSTEM_OUT, isStartupLoggedToSystemOut());
return attributes;
}
@@ -382,4 +383,19 @@ public class BrokerOptions
return _configProperties.get(QPID_HOME_DIR);
}
+ /*
+ * Temporary method for test purposes
+ */
+ public boolean isStartupLoggedToSystemOut()
+ {
+ return _startupLoggedToSystemOut;
+ }
+
+ /*
+ * Temporary method for test purposes
+ */
+ public void setStartupLoggedToSystemOut(boolean startupLoggedToSystemOut)
+ {
+ this._startupLoggedToSystemOut = startupLoggedToSystemOut;
+ }
}