ch.qos.logback.core.Appender.setName()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(166)

本文整理了Java中ch.qos.logback.core.Appender.setName()方法的一些代码示例,展示了Appender.setName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Appender.setName()方法的具体详情如下:
包路径:ch.qos.logback.core.Appender
类名称:Appender
方法名:setName

Appender.setName介绍

[英]Set the name of this appender. The name is used by other components to identify this appender.
[中]设置此追加器的名称。其他组件使用该名称来标识此追加器。

代码示例

代码示例来源:origin: org.springframework.boot/spring-boot

public void appender(String name, Appender<?> appender) {
  appender.setName(name);
  start(appender);
}

代码示例来源:origin: ctripcorp/apollo

private void tryConfigCLogging() throws Exception {
 String appId = Foundation.app().getAppId();
 if (Strings.isNullOrEmpty(appId)) {
  logger.warn("App id is null or empty!");
  return;
 }
 LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
 Class clazz = Class.forName(cLoggingAppenderClass);
 Appender cLoggingAppender = (Appender) clazz.newInstance();
 ReflectionUtils.findMethod(clazz, "setAppId", String.class).invoke(cLoggingAppender, appId);
 ReflectionUtils.findMethod(clazz, "setServerIp", String.class)
   .invoke(cLoggingAppender, cloggingUrl());
 ReflectionUtils.findMethod(clazz, "setServerPort", int.class)
   .invoke(cLoggingAppender, Integer.parseInt(cloggingPort()));
 cLoggingAppender.setName("CentralLogging");
 cLoggingAppender.setContext(loggerContext);
 cLoggingAppender.start();
 ch.qos.logback.classic.Logger logger =
   (ch.qos.logback.classic.Logger) LoggerFactory.getLogger("root");
 logger.addAppender(cLoggingAppender);
}

代码示例来源:origin: camunda/camunda-bpm-platform

+ "].");
} else {
 appender.setName(appenderName);
 addInfo("Naming appender as [" + appenderName + "]");

代码示例来源:origin: caskdata/cdap

@Override
public void setName(String name) {
 delegate.setName(name);
}

代码示例来源:origin: co.cask.cdap/cdap-watchdog

@Override
public void setName(String name) {
 delegate.setName(name);
}

代码示例来源:origin: org.antframework.boot/ant-boot-starter-log

public void appender(String name, Appender<?> appender) {
  appender.setName(name);
  start(appender);
}

代码示例来源:origin: Audiveris/audiveris

/**
 * 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);
}

代码示例来源:origin: uk.gov.dstl.baleen/baleen-core

/**
  * 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(appender::addFilter);
  }

  return appender;
 }
}

代码示例来源:origin: dstl/baleen

/**
  * 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(appender::addFilter);
  }

  return appender;
 }
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

addWarn("No appender name given for appender of type " + className + "].");
} else {
  appender.setName(appenderName);
  addInfo("Naming appender as [" + appenderName + "]");

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

addWarn("No appender name given for appender of type " + className + "].");
} else {
  appender.setName(appenderName);
  addInfo("Naming appender as [" + appenderName + "]");

代码示例来源:origin: Nextdoor/bender

addWarn("No appender name given for appender of type " + className + "].");
} else {
  appender.setName(appenderName);
  addInfo("Naming appender as [" + appenderName + "]");

代码示例来源:origin: tony19/logback-android

+ "].");
} else {
 appender.setName(appenderName);
 addInfo("Naming appender as [" + appenderName + "]");

代码示例来源:origin: ch.qos.logback/core

+ "].");
} else {
 appender.setName(appenderName);
 addInfo("Naming appender as [" + appenderName + "]");

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/ch.qos.logback.core

+ "].");
} else {
 appender.setName(appenderName);
 addInfo("Naming appender as [" + appenderName + "]");

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

+ "].");
} else {
 appender.setName(appenderName);
 addInfo("Naming appender as [" + appenderName + "]");

代码示例来源:origin: com.hynnet/logback-core

+ "].");
} else {
 appender.setName(appenderName);
 addInfo("Naming appender as [" + appenderName + "]");

代码示例来源:origin: tony19/logback-android

@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\\].");
 }
}

代码示例来源:origin: org.apache.marmotta/marmotta-core

appender.setName(output.getId());

代码示例来源:origin: apache/marmotta

appender.setName(output.getId());

相关文章