本文整理汇总了Java中ch.qos.logback.core.read.ListAppender.setName方法的典型用法代码示例。如果您正苦于以下问题:Java ListAppender.setName方法的具体用法?Java ListAppender.setName怎么用?Java ListAppender.setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ch.qos.logback.core.read.ListAppender
的用法示例。
在下文中一共展示了ListAppender.setName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testConfigurationMissingFileLogsWarning
import ch.qos.logback.core.read.ListAppender; //导入方法依赖的package包/类
@Test
public void testConfigurationMissingFileLogsWarning() throws Exception {
final Map<String, String> configProperties = new HashMap<String, String>();
configProperties.put(FileIdentityProvider.PROPERTY_EXPIRATION_PERIOD, FIVE_MINUTES);
final String missingFilePath = "no/such/file";
configProperties.put(FileIdentityProvider.PROPERTY_CREDENTIALS_FILE, missingFilePath);
final LoginIdentityProviderConfigurationContext configContext =
new MockLoginIdentityProviderConfigurationContext(IDENTIFIER, configProperties);
Logger fileIdentityProviderLogger = (Logger) LoggerFactory.getLogger(FileIdentityProvider.class);
ListAppender<ILoggingEvent> testAppender = new ListAppender<>();
testAppender.setName("Test");
testAppender.start();
fileIdentityProviderLogger.addAppender(testAppender);
final FileIdentityProvider provider = new FileIdentityProvider();
provider.onConfigured(configContext);
boolean fileMessageFound = false;
for (ILoggingEvent event : testAppender.list) {
String message = event.getFormattedMessage();
if (message.contains(missingFilePath) && event.getLevel() == Level.WARN) {
fileMessageFound = true;
break;
}
}
Assert.assertTrue(fileMessageFound);
}
示例2: buildAppender
import ch.qos.logback.core.read.ListAppender; //导入方法依赖的package包/类
public Appender<Object> buildAppender(Context context, String discriminatingValue) throws JoranException {
ListAppender<Object> la = new ListAppender<Object>();
la.setContext(context);
la.setName(discriminatingValue);
la.start();
return la;
}
示例3: add
import ch.qos.logback.core.read.ListAppender; //导入方法依赖的package包/类
public LogbackJUnitRule add(String name) {
ListAppender<ILoggingEvent> appender = new com.github.skjolber.log.domain.test.ListAppender();
appender.setName(name);
Logger logger = (Logger) LoggerFactory.getLogger(name);
logger.addAppender(appender);
entries.add(new Entry(logger, appender));
appender.start();
return this;
}