Search in sources :

Example 1 with MessageLogger

use of org.apache.qpid.server.logging.MessageLogger in project qpid-broker-j by apache.

the class SystemLauncher method startupImpl.

private void startupImpl(Map<String, Object> systemConfigAttributes) throws Exception {
    populateSystemPropertiesFromDefaults((String) systemConfigAttributes.get(SystemConfig.INITIAL_SYSTEM_PROPERTIES_LOCATION));
    String storeType = (String) systemConfigAttributes.get(SystemConfig.TYPE);
    // Create the RootLogger to be used during broker operation
    boolean statusUpdatesEnabled = Boolean.parseBoolean(System.getProperty(SystemConfig.PROPERTY_STATUS_UPDATES, "true"));
    MessageLogger messageLogger = new LoggingMessageLogger(statusUpdatesEnabled);
    _eventLogger.setMessageLogger(messageLogger);
    PluggableFactoryLoader<SystemConfigFactory> configFactoryLoader = new PluggableFactoryLoader<>(SystemConfigFactory.class);
    SystemConfigFactory configFactory = configFactoryLoader.get(storeType);
    if (configFactory == null) {
        LOGGER.error("Unknown config store type '" + storeType + "', only the following types are supported: " + configFactoryLoader.getSupportedTypes());
        throw new IllegalArgumentException("Unknown config store type '" + storeType + "', only the following types are supported: " + configFactoryLoader.getSupportedTypes());
    }
    _taskExecutor.start();
    _systemConfig = configFactory.newInstance(_taskExecutor, _eventLogger, _systemPrincipal, systemConfigAttributes);
    _systemConfig.setOnContainerResolveTask(new Runnable() {

        @Override
        public void run() {
            _listener.onContainerResolve(_systemConfig);
        }
    });
    _systemConfig.setOnContainerCloseTask(new Runnable() {

        @Override
        public void run() {
            _listener.onContainerClose(_systemConfig);
        }
    });
    _systemConfig.open();
    if (_systemConfig.getContainer().getState() == State.ERRORED) {
        throw new RuntimeException("Closing due to errors");
    }
}
Also used : SystemOutMessageLogger(org.apache.qpid.server.logging.SystemOutMessageLogger) MessageLogger(org.apache.qpid.server.logging.MessageLogger) LoggingMessageLogger(org.apache.qpid.server.logging.LoggingMessageLogger) LoggingMessageLogger(org.apache.qpid.server.logging.LoggingMessageLogger) SystemConfigFactory(org.apache.qpid.server.plugin.SystemConfigFactory) PluggableFactoryLoader(org.apache.qpid.server.plugin.PluggableFactoryLoader)

Example 2 with MessageLogger

use of org.apache.qpid.server.logging.MessageLogger in project qpid-broker-j by apache.

the class AbstractSystemConfig method initiateStartupLogging.

private EventLogger initiateStartupLogging() {
    final EventLogger eventLogger = _eventLogger;
    final EventLogger startupLogger;
    if (isStartupLoggedToSystemOut()) {
        // Create the composite (logging+SystemOut MessageLogger to be used during startup
        MessageLogger[] messageLoggers = { new SystemOutMessageLogger(), eventLogger.getMessageLogger() };
        CompositeStartupMessageLogger startupMessageLogger = new CompositeStartupMessageLogger(messageLoggers);
        startupLogger = new EventLogger(startupMessageLogger);
    } else {
        startupLogger = eventLogger;
    }
    return startupLogger;
}
Also used : EventLogger(org.apache.qpid.server.logging.EventLogger) CompositeStartupMessageLogger(org.apache.qpid.server.logging.CompositeStartupMessageLogger) SystemOutMessageLogger(org.apache.qpid.server.logging.SystemOutMessageLogger) MessageLogger(org.apache.qpid.server.logging.MessageLogger) SystemOutMessageLogger(org.apache.qpid.server.logging.SystemOutMessageLogger) CompositeStartupMessageLogger(org.apache.qpid.server.logging.CompositeStartupMessageLogger)

Aggregations

MessageLogger (org.apache.qpid.server.logging.MessageLogger)2 SystemOutMessageLogger (org.apache.qpid.server.logging.SystemOutMessageLogger)2 CompositeStartupMessageLogger (org.apache.qpid.server.logging.CompositeStartupMessageLogger)1 EventLogger (org.apache.qpid.server.logging.EventLogger)1 LoggingMessageLogger (org.apache.qpid.server.logging.LoggingMessageLogger)1 PluggableFactoryLoader (org.apache.qpid.server.plugin.PluggableFactoryLoader)1 SystemConfigFactory (org.apache.qpid.server.plugin.SystemConfigFactory)1