当前位置: 首页>>代码示例>>Java>>正文


Java ListAppender.setName方法代码示例

本文整理汇总了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);
}
 
开发者ID:BatchIQ,项目名称:nifi-file-identity-provider-bundle,代码行数:28,代码来源:TestFileIdentityProvider.java

示例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;
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:8,代码来源:AppenderTrackerTest.java

示例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;
}
 
开发者ID:skjolber,项目名称:json-log-domain,代码行数:15,代码来源:LogbackJUnitRule.java


注:本文中的ch.qos.logback.core.read.ListAppender.setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。