當前位置: 首頁>>代碼示例>>Java>>正文


Java Appender.setName方法代碼示例

本文整理匯總了Java中ch.qos.logback.core.Appender.setName方法的典型用法代碼示例。如果您正苦於以下問題:Java Appender.setName方法的具體用法?Java Appender.setName怎麽用?Java Appender.setName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ch.qos.logback.core.Appender的用法示例。


在下文中一共展示了Appender.setName方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: build

import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
@Override
public Appender<E> build(final LoggerContext context,
                         final String applicationName,
                         final LayoutFactory<E> layoutFactory,
                         final LevelFilterFactory<E> levelFilterFactory,
                         final AsyncAppenderFactory<E> asyncAppenderFactory) {
    final Appender<E> appender = new FifoLogbackAppender<>();

    appender.setContext(context);

    appender.addFilter(levelFilterFactory.build(threshold));
    getFilterFactories().forEach(f -> appender.addFilter(f.build()));
    appender.start();
    appender.setName(APPENDER_NAME);

    return appender;
}
 
開發者ID:gchq,項目名稱:stroom-query,代碼行數:18,代碼來源:FifoLogbackAppenderFactory.java

示例2: configureAppender

import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
private Appender<ILoggingEvent> configureAppender(LoggerContext loggerContext, String name, Config config)
        throws ReflectiveOperationException {
    List<Object> children = new ArrayList<>();

    @SuppressWarnings("unchecked")
    Class<Appender<ILoggingEvent>> clazz = (Class<Appender<ILoggingEvent>>) Class
            .forName(config.getString("class"));

    Appender<ILoggingEvent> appender = this.configureObject(loggerContext, clazz, config, children);
    appender.setName(name);

    for (Object child : children) {
        if (child instanceof RollingPolicy) {
            ((RollingPolicy) child).setParent((FileAppender<?>) appender);
        }
        if (child instanceof LifeCycle) {
            ((LifeCycle) child).start();
        }
    }

    appender.start();
    return appender;

}
 
開發者ID:gnieh,項目名稱:logback-config,代碼行數:25,代碼來源:ConfigConfigurator.java

示例3: build

import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
@Override
public Appender<E> build(final LoggerContext context,
                      final String applicationName,
                      final LayoutFactory<E> layoutFactory,
                      final LevelFilterFactory<E> levelFilterFactory,
                      final AsyncAppenderFactory<E> asyncAppenderFactory) {

    final Properties producerConfigProperties = producerConfig.stream()
            .map(s -> s.split("="))
            .filter(values -> values.length == 2)
            .reduce(new Properties(), (props, values) -> {
                props.setProperty(values[0], values[1]);
                return props;
            }, (p1, p2) -> {
                Properties merged = new Properties();
                merged.putAll(p1);
                merged.putAll(p2);
                return merged;
            });

    final Appender<E> appender = new KafkaLogbackAppender<>(producerConfigProperties, topic);

    appender.setContext(context);

    appender.addFilter(levelFilterFactory.build(threshold));
    getFilterFactories().forEach(f -> appender.addFilter(f.build()));
    appender.start();
    appender.setName(APPENDER_NAME);

    return appender;
    //return wrapAsync(appender, asyncAppenderFactory);
}
 
開發者ID:gchq,項目名稱:stroom-query,代碼行數:33,代碼來源:KafkaLogbackAppenderFactory.java

示例4: addGuiAppender

import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
/**
 * Add a specific appender meant for GUI log pane.
 * To be called only when running with a GUI.
 */
public static void addGuiAppender ()
{
    // GUI (filtered in LogGuiAppender)
    LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
    Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(
            Logger.ROOT_LOGGER_NAME);
    Appender guiAppender = new LogGuiAppender();
    guiAppender.setName("GUI");
    guiAppender.setContext(loggerContext);
    guiAppender.start();
    root.addAppender(guiAppender);
}
 
開發者ID:Audiveris,項目名稱:audiveris,代碼行數:17,代碼來源:LogUtil.java

示例5: testNoStart

import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
@Test
public void testNoStart() {
  Appender<E> appender = getAppender();
  appender.setContext(context);
  appender.setName("doh");
  // is null OK?
  appender.doAppend(null);
  StatusChecker checker = new StatusChecker(context.getStatusManager());
  StatusPrinter.print(context);
  checker.assertContainsMatch("Attempted to append to non started appender \\[doh\\].");
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:12,代碼來源:AbstractAppenderTest.java

示例6: build

import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
/**
 * Build a new appender for the specified context and encoder (where required).
 * 
 * @param context The logger context
 * @param encoder The encoder to use (if that is possible for the specific appender)
 * @return The new appender
 */
@Override
public final Appender<ILoggingEvent> build(LoggerContext context, Encoder<ILoggingEvent> encoder) {
    Appender<ILoggingEvent> appender = createAppender(context, encoder);
    appender.setName(name);
    appender.setContext(context);

    if (filters != null) {
        filters.forEach(f -> appender.addFilter(f));
    }

    return appender;
}
 
開發者ID:dstl,項目名稱:baleen,代碼行數:20,代碼來源:AbstractBaleenLoggerBuilder.java


注:本文中的ch.qos.logback.core.Appender.setName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。