Search in sources :

Example 1 with AbstractBrokerLogger

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

the class BrokerLoggerTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    _taskExecutor = new TaskExecutorImpl();
    _taskExecutor.start();
    _loggerAppender = new ListAppender<>();
    _loggerAppender.setName(APPENDER_NAME);
    Model model = BrokerModel.getInstance();
    _broker = mock(Broker.class);
    when(_broker.getCategoryClass()).thenReturn(Broker.class);
    when(_broker.getTypeClass()).thenReturn(Broker.class);
    when(_broker.getModel()).thenReturn(model);
    when(_broker.getChildExecutor()).thenReturn(_taskExecutor);
    doReturn(Broker.class).when(_broker).getCategoryClass();
    Map<String, Object> attributes = new HashMap<>();
    attributes.put("name", APPENDER_NAME);
    _brokerLogger = new AbstractBrokerLogger(attributes, _broker) {

        @Override
        public Appender<ILoggingEvent> createAppenderInstance(Context context) {
            return _loggerAppender;
        }
    };
    _brokerLogger.open();
}
Also used : Context(ch.qos.logback.core.Context) Appender(ch.qos.logback.core.Appender) ListAppender(ch.qos.logback.core.read.ListAppender) TaskExecutorImpl(org.apache.qpid.server.configuration.updater.TaskExecutorImpl) Broker(org.apache.qpid.server.model.Broker) HashMap(java.util.HashMap) AbstractBrokerLogger(org.apache.qpid.server.logging.logback.AbstractBrokerLogger) BrokerModel(org.apache.qpid.server.model.BrokerModel) Model(org.apache.qpid.server.model.Model) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject)

Aggregations

Appender (ch.qos.logback.core.Appender)1 Context (ch.qos.logback.core.Context)1 ListAppender (ch.qos.logback.core.read.ListAppender)1 HashMap (java.util.HashMap)1 TaskExecutorImpl (org.apache.qpid.server.configuration.updater.TaskExecutorImpl)1 AbstractBrokerLogger (org.apache.qpid.server.logging.logback.AbstractBrokerLogger)1 Broker (org.apache.qpid.server.model.Broker)1 BrokerModel (org.apache.qpid.server.model.BrokerModel)1 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)1 Model (org.apache.qpid.server.model.Model)1