use of org.apache.qpid.server.model.VirtualHostLogger in project qpid-broker-j by apache.
the class VirtualHostLoggerTest method testLoggersRemovedOnVirtualHostClose.
@Test
public void testLoggersRemovedOnVirtualHostClose() {
VirtualHostLogger logger = createVirtualHostLogger();
_virtualHost.close();
Appender<ILoggingEvent> appender = ((ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)).getAppender(logger.getName());
assertNull("Appender was not deleted", appender);
}
use of org.apache.qpid.server.model.VirtualHostLogger in project qpid-broker-j by apache.
the class VirtualHostLoggerTest method testLoggersRemovedOnVirtualHostStop.
@Test
public void testLoggersRemovedOnVirtualHostStop() {
VirtualHostLogger logger = createVirtualHostLogger();
((AbstractConfiguredObject<?>) _virtualHost).stop();
Appender<ILoggingEvent> appender = ((ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)).getAppender(logger.getName());
assertNull("Appender was not deleted", appender);
}
use of org.apache.qpid.server.model.VirtualHostLogger in project qpid-broker-j by apache.
the class VirtualHostLoggerTest method testAddLoggerWithRollDailyOn.
@Test
public void testAddLoggerWithRollDailyOn() {
VirtualHostLogger logger = createVirtualHostLogger(Collections.<String, Object>singletonMap("rollDaily", true));
assertTrue("Unexpected logger created " + logger, logger instanceof VirtualHostFileLogger);
assertEquals("Unexpected log file", _logFile.getPath(), ((VirtualHostFileLogger<?>) logger).getFileName());
assertEquals("Unexpected state on creation", State.ACTIVE, logger.getState());
assertTrue("Log file does not exists", _logFile.exists());
Appender<ILoggingEvent> appender = ((ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)).getAppender(logger.getName());
assertTrue("Appender was not started", appender.isStarted());
}
use of org.apache.qpid.server.model.VirtualHostLogger in project qpid-broker-j by apache.
the class VirtualHostLoggerTest method testAddLoggerWithDefaultSettings.
@Test
public void testAddLoggerWithDefaultSettings() {
VirtualHostLogger logger = createVirtualHostLogger();
assertTrue("Unexpected logger created " + logger, logger instanceof VirtualHostFileLogger);
assertEquals("Unexpected log file", _logFile.getPath(), ((VirtualHostFileLogger<?>) logger).getFileName());
assertEquals("Unexpected state on creation", State.ACTIVE, logger.getState());
assertTrue("Log file does not exists", _logFile.exists());
Appender<ILoggingEvent> appender = ((ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)).getAppender(logger.getName());
assertTrue("Appender was not started", appender.isStarted());
}
use of org.apache.qpid.server.model.VirtualHostLogger in project qpid-broker-j by apache.
the class VirtualHostLoggerTest method testDeleteLogger.
@Test
public void testDeleteLogger() {
VirtualHostLogger logger = createVirtualHostLogger();
assertEquals("Unexpected state on creation", State.ACTIVE, logger.getState());
Appender<ILoggingEvent> appender = ((ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)).getAppender(logger.getName());
assertTrue("Appender is not started", appender.isStarted());
logger.delete();
appender = ((ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)).getAppender(logger.getName());
assertNull("Appender should be detached on logger deletion", appender);
}
Aggregations