Java 类ch.qos.logback.classic.PatternLayout 实例源码

项目:thirdcoast    文件:LoggingConfigurator.java   
@Override
public void configure(LoggerContext lc) {
  addInfo("Setting up robot logging configuration.");

  ConsoleAppender<ILoggingEvent> ca = new ConsoleAppender<>();
  ca.setContext(lc);
  ca.setName("console");
  LayoutWrappingEncoder<ILoggingEvent> encoder = new LayoutWrappingEncoder<>();
  encoder.setContext(lc);

  PatternLayout layout = new PatternLayout();
  layout.setPattern("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n");

  layout.setContext(lc);
  layout.start();
  encoder.setLayout(layout);

  ca.setEncoder(encoder);
  ca.start();

  Logger rootLogger = lc.getLogger(Logger.ROOT_LOGGER_NAME);
  rootLogger.addAppender(ca);
  rootLogger.setLevel(Level.DEBUG);
}
项目:oma-riista-web    文件:PapertrailConfig.java   
private static void enablePaperTrail(final String hostname, final int port, final String ident) {
    final LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();

    final PatternLayout patternLayout = new PatternLayout();
    patternLayout.setContext(lc);
    patternLayout.setPattern(LOG_PATTERN);
    patternLayout.start();

    final SSLTCPNetSyslogConfig syslogConfig = new SSLTCPNetSyslogConfig(hostname, port);
    syslogConfig.setIdent(ident);
    syslogConfig.setMaxMessageLength(128000);
    syslogConfig.setSendLocalTimestamp(false);
    syslogConfig.setSendLocalName(false);

    final Syslog4jAppender<ILoggingEvent> syslog4jAppender = new Syslog4jAppender<>();
    syslog4jAppender.setSyslogConfig(syslogConfig);
    syslog4jAppender.setLayout(patternLayout);
    syslog4jAppender.start();

    final Logger logger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);

    logger.addAppender(syslog4jAppender);
    logger.setLevel(Level.DEBUG);
    logger.setAdditive(true); /* set to true if root should log too */
}
项目:bartleby    文件:Log4jInvocation.java   
@Test
public void callerData() {
  assertEquals(0, listAppender.list.size());

  PatternLayout pl = new PatternLayout();
  pl.setPattern("%-5level [%class] %logger - %msg");
  pl.setContext(lc);
  pl.start();
  listAppender.layout = pl;

  Logger logger = Logger.getLogger("basic-test");
  logger.trace("none");
  assertEquals(0, listAppender.list.size());

  rootLogger.setLevel(Level.TRACE);
  logger.trace(HELLO);
  assertEquals(1, listAppender.list.size());

  ILoggingEvent event = (ILoggingEvent) listAppender.list.get(0);
  assertEquals(HELLO, event.getMessage());

  assertEquals(1, listAppender.stringList.size());
  assertEquals("TRACE [" + Log4jInvocation.class.getName()
      + "] basic-test - Hello", listAppender.stringList.get(0));
}
项目:bartleby    文件:ExtendedThrowableProxyConverterTest.java   
@Test
public void integration() {
  PatternLayout pl = new PatternLayout();
  pl.setContext(lc);
  pl.setPattern("%m%n");
  pl.start();
  ILoggingEvent e = createLoggingEvent(new Exception("x"));
  String res = pl.doLayout(e);

  // make sure that at least some package data was output
  Pattern p = Pattern.compile("\\s*at .*?\\[.*?\\]");
  Matcher m = p.matcher(res);
  int i = 0;
  while(m.find()) {
    i++;
  }
  assertTrue(i+ " should be larger than 5", i > 5);
}
项目:bartleby    文件:RootCauseFirstThrowableProxyConverterTest.java   
@Test
public void integration() {
  //given
  PatternLayout pl = new PatternLayout();
  pl.setContext(context);
  pl.setPattern("%m%rEx%n");
  pl.start();

  //when
  ILoggingEvent e = createLoggingEvent(new Exception("x"));
  String result = pl.doLayout(e);

  //then
  // make sure that at least some package data was output
  Pattern p = Pattern.compile("\\s*at .*?\\[.*?\\]");
  Matcher m = p.matcher(result);
  int i = 0;
  while(m.find()) {
    i++;
  }
  assertThat(i).isGreaterThan(5);
}
项目:Pushjet-Android    文件:LogbackLoggingConfigurer.java   
private void doFailSafeConfiguration() {
    // Not really fail-safe, just less likely to fail
    final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
    context.reset();
    Logger rootLogger = context.getLogger(Logger.ROOT_LOGGER_NAME);
    rootLogger.setLevel(Level.INFO);

    ConsoleAppender<ILoggingEvent> appender = new ConsoleAppender<ILoggingEvent>();
    rootLogger.addAppender(appender);
    appender.setContext(context);
    appender.setTarget("System.err");

    PatternLayout layout = new PatternLayout();
    appender.setLayout(layout);
    layout.setPattern("%msg%n%ex");
    layout.setContext(context);

    layout.start();
    appender.start();
}
项目:Pushjet-Android    文件:LogbackLoggingConfigurer.java   
private void doFailSafeConfiguration() {
    // Not really fail-safe, just less likely to fail
    final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
    context.reset();
    Logger rootLogger = context.getLogger(Logger.ROOT_LOGGER_NAME);
    rootLogger.setLevel(Level.INFO);

    ConsoleAppender<ILoggingEvent> appender = new ConsoleAppender<ILoggingEvent>();
    rootLogger.addAppender(appender);
    appender.setContext(context);
    appender.setTarget("System.err");

    PatternLayout layout = new PatternLayout();
    appender.setLayout(layout);
    layout.setPattern("%msg%n%ex");
    layout.setContext(context);

    layout.start();
    appender.start();
}
项目:digdag    文件:LogbackTaskContextLoggerBridgeAppender.java   
@Override
public void start()
{
    if (isStarted()) {
        return;
    }

    PatternLayout patternLayout = new PatternLayout();
    patternLayout.setContext(context);
    patternLayout.setPattern(PATTERN);
    patternLayout.setOutputPatternAsHeader(false);
    patternLayout.start();
    this.layout = patternLayout;

    super.start();
}
项目:tddl5    文件:DynamicLogback918Logger.java   
protected Appender buildAppender(String name, String fileName, String pattern) {
    RollingFileAppender appender = new RollingFileAppender();
    appender.setContext(loggerContext);
    appender.setName(name);
    appender.setAppend(true);
    appender.setFile(new File(getLogPath(), fileName).getAbsolutePath());

    TimeBasedRollingPolicy rolling = new TimeBasedRollingPolicy();
    rolling.setParent(appender);
    rolling.setFileNamePattern(new File(getLogPath(), fileName).getAbsolutePath() + ".%d{yyyy-MM-dd}");
    rolling.setContext(loggerContext);
    rolling.start();
    appender.setRollingPolicy(rolling);

    PatternLayout layout = new PatternLayout();
    layout.setPattern(pattern);
    layout.setContext(loggerContext);
    layout.start();
    appender.setLayout(layout);
    // 启动
    appender.start();
    return appender;
}
项目:tddl5    文件:DynamicLogback918Logger.java   
protected Appender buildDailyMaxRollingAppender(String name, String fileName, String pattern, int maxBackupIndex) {
    RollingFileAppender appender = new RollingFileAppender();
    appender.setContext(loggerContext);
    appender.setName(name);
    appender.setAppend(true);
    appender.setFile(new File(getLogPath(), fileName).getAbsolutePath());

    TimeBasedRollingPolicy rolling = new TimeBasedRollingPolicy();
    rolling.setContext(loggerContext);
    rolling.setFileNamePattern(new File(getLogPath(), fileName).getAbsolutePath() + ".%d{yyyy-MM-dd-HH}");
    rolling.setMaxHistory(maxBackupIndex);
    rolling.setParent(appender);
    rolling.start();
    appender.setRollingPolicy(rolling);

    PatternLayout layout = new PatternLayout();
    layout.setContext(loggerContext);
    layout.setPattern(pattern);
    layout.start();
    appender.setLayout(layout);
    // 启动
    appender.start();
    return appender;
}
项目:croquet    文件:CroquetLoggingFactory.java   
private ConsoleAppender<ILoggingEvent> getConsoleAppender(final LoggingSettings.Console settings,
                                                                final LoggerContext context) {
    final PatternLayout formatter = getPatternLayout(context);
    formatter.setPattern(settings.getLogFormat());
    formatter.start();

    final ConsoleAppender<ILoggingEvent> appender = new ConsoleAppender<ILoggingEvent>();
    appender.setContext(context);
    appender.setLayout(formatter);

    addThresholdFilter(appender, settings.getThreshold());

    appender.start();

    return appender;
}
项目:logback-steno    文件:KeyValueEncoderTest.java   
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    _context = new LoggerContext();
    _context.start();
    _baos = new ByteArrayOutputStream();
    _encoder = new KeyValueEncoder();
    _encoder.setImmediateFlush(true);

    final PatternLayout layout = new PatternLayout();
    layout.setPattern("[%d{dd MMM yyyy HH:mm:ss.SSS,UTC}] %t - %m%n");
    layout.setContext(_context);
    layout.start();
    _encoder.setLayout(layout);
    _encoder.setContext(_context);
    Mockito.doThrow(new RuntimeException("Mocked Failure")).when(_throwingLayout).doLayout(Mockito.any(ILoggingEvent.class));
}
项目:owasp-security-logging    文件:CRLFConverterTest.java   
@Before
public void setUp() {
    PatternLayout.defaultConverterMap.put("crlf",
            CRLFConverter.class.getName());
    // layout = new PatternLayout();

    encoder = new PatternLayoutEncoder();
    encoder.setContext(loggerContext);
    encoder.setPattern("%-4relative [%thread] %-5level %logger{35} - %crlf(%msg)%n");
    encoder.start();

    // Layout layout = new PatternLayout();
    // layout.setEncoder(encoder);

    mockAppender.setContext(loggerContext);
    mockAppender.setEncoder(encoder);
    mockAppender.start();

    LOGGER = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
    LOGGER.addAppender(mockAppender);
}
项目:owasp-security-logging    文件:MaskingConverterTest.java   
@Before
public void setUp() {
    PatternLayout.defaultConverterMap.put("mask",
            MaskingConverter.class.getName());

    encoder = new PatternLayoutEncoder();
    encoder.setContext(loggerContext);
    encoder.setPattern("%-4relative [%thread] %-5level %logger{35} - %mask%n");
    encoder.start();

    mockAppender.setContext(loggerContext);
    mockAppender.setEncoder(encoder);
    mockAppender.start();

    LOGGER.addAppender(mockAppender);
}
项目:lens    文件:LensConnectionCommands.java   
/**
 * Check whether ConsoleAppender was already added
 * @param logger
 * @return true   if it was already added
 *         false  if it does not contain ConsoleAppender
 */
public static void addConsoleAppenderIfNotPresent(Logger logger) {
  boolean isConsoleAppenderAdded = false;
  PatternLayout layout = null;
  Iterator<Appender<ILoggingEvent>> appenderSeries = logger.iteratorForAppenders();
  while (appenderSeries.hasNext()) {
    Appender<ILoggingEvent> appender = (Appender<ILoggingEvent>) appenderSeries.next();
    if (appender instanceof ConsoleAppender) {
      isConsoleAppenderAdded = true;
      break;
    }
  }
  if (!isConsoleAppenderAdded) {
    if (layout == null) {
      layout = LoggerUtil.getPatternLayout(logger.getLoggerContext());
    }
    if (logger.getLevel() == null) {
      logger.setLevel(Level.DEBUG);
    }
    ConsoleAppender<ILoggingEvent> consoleAppender = LoggerUtil.getConsoleAppender(layout,
      logger.getLoggerContext());
    logger.addAppender(consoleAppender);
  }
}
项目:kloudmake    文件:Cli.java   
@SuppressWarnings("unchecked")
public static void configureLogging(Level level) {
    ch.qos.logback.classic.Logger valverlog = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Version.class);
    valverlog.setLevel(ERROR);
    ch.qos.logback.classic.Logger reflog = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Reflections.class);
    reflog.setLevel(ERROR);
    ch.qos.logback.classic.Logger logger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger("ROOT");
    LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
    ConsoleAppender console = (ConsoleAppender) logger.getAppender("console");
    logger.setLevel(level);
    console.stop();
    PatternLayout pl = new PatternLayout();
    pl.setPattern("%r %5p [%X{resource}] %m%n%nopex");
    pl.setContext(lc);
    pl.start();
    console.setLayout(pl);
    console.start();
}
项目:logback-flume-ng    文件:FlumeAppenderTest.java   
private FlumeAppender createAppender(final Agent... agents) {
  PatternLayout layout = new PatternLayout();
  layout.setContext(ctx);
  layout.setPattern("%d{yyyy-MM-dd HH:mm:ss} %c [%p] %m%n");
  layout.start();

  final FlumeAppender avroAppender = new FlumeAppender();
  if (null == agents || agents.length == 0) {
    avroAppender.addAgent(Agent.create("localhost", testPort));
  } else {
    for (Agent agent : agents) {
      avroAppender.addAgent(agent);
    }
  }
  avroAppender.setCompressBody(true);
  avroAppender.setType("avro");
  avroAppender.setLayout(layout);
  avroAppender.setName("FlumeAppender");
  avroAppender.start();
  return avroAppender;
}
项目:MantaroRPG    文件:DiscordLogBack.java   
@Override
public void start() {
    patternLayout = new PatternLayout();
    patternLayout.setContext(getContext());
    patternLayout.setPattern("[`%d{HH:mm:ss}`] [`%t/%level`] [`%logger{0}`]: %msg");
    patternLayout.start();

    super.start();
}
项目:tasfe-framework    文件:TasfeFilePatternLayout.java   
public void start() {
    PatternLayout patternLayout = new PatternLayout();
    patternLayout.setContext(this.context);
    patternLayout.setPattern(this.getPattern());
    patternLayout.setOutputPatternAsHeader(this.outputPatternAsHeader);
    patternLayout.start();
    super.start();
}
项目:Blizcord    文件:Log.java   
private static void setupOwnLogger() {
    LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();

    logger = (Logger) LoggerFactory.getLogger(Values.BOT_NAME);
    ConsoleAppender<ILoggingEvent> consoleAppender = new ConsoleAppender<>();
    consoleAppender.setContext(lc);
    consoleAppender.setName("console");
    LayoutWrappingEncoder<ILoggingEvent> encoder = new LayoutWrappingEncoder<>();

    PatternLayout layout = new PatternLayout();
    layout.setPattern("[%d{HH:mm:ss}] [%level] [%logger] %msg%n");
    layout.setContext(lc);
    layout.start();
    encoder.setLayout(layout);

    consoleAppender.setEncoder(encoder);
    consoleAppender.start();

    // disable default appender
    logger.setAdditive(false);

    // enable custom console appender
    logger.addAppender(consoleAppender);

    // set logging level
    if(a.isDebug()) {
        logger.setLevel(Level.DEBUG);
    } else {
        logger.setLevel(Level.INFO);
    }
}
项目:wngn-jms-kafka    文件:KafkaAppenderIT.java   
@Before
public void beforeLogSystemInit() throws IOException, InterruptedException {

    kafka = TestKafka.createTestKafka(1);

    loggerContext = new LoggerContext();
    loggerContext.putProperty("brokers.list", kafka.getBrokerList());
    loggerContext.getStatusManager().add(new StatusListener() {
        @Override
        public void addStatusEvent(Status status) {
            if (status.getEffectiveLevel() > Status.INFO) {
                System.err.println(status.toString());
                if (status.getThrowable() != null) {
                    collector.addError(status.getThrowable());
                } else {
                    collector.addError(new RuntimeException("StatusManager reported warning: "+status.toString()));
                }
            } else {
                System.out.println(status.toString());
            }
        }
    });
    loggerContext.putProperty("HOSTNAME","localhost");

    unit = new KafkaAppender<ILoggingEvent>();
    final PatternLayout patternLayout = new PatternLayout();
    patternLayout.setPattern("%msg");
    patternLayout.setContext(loggerContext);
    patternLayout.start();
    unit.setEncoder(new LayoutKafkaMessageEncoder(patternLayout, Charset.forName("UTF-8")));
    unit.setTopic("logs");
    unit.setName("TestKafkaAppender");
    unit.setContext(loggerContext);
    unit.addProducerConfigValue(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, kafka.getBrokerList());
    unit.setKeyingStrategy(new RoundRobinKeyingStrategy());
}
项目:openvisualtraceroute    文件:LogWindow.java   
@Override
public void start() {
    patternLayout = new PatternLayout();
    patternLayout.setContext(getContext());
    patternLayout.setPattern("%date %level [%thread] %logger{10}:%line %msg%n");
    patternLayout.start();
    super.start();
}
项目:thirdcoast    文件:LoggingConfigurator.java   
@Override
public void configure(LoggerContext lc) {
  addInfo("Setting up robot logging configuration.");

  FileAppender<ILoggingEvent> fa = new FileAppender<>();
  fa.setFile("tct.log");
  fa.setAppend(true);
  ConsoleAppender<ILoggingEvent> ca = new ConsoleAppender<>();
  ca.setContext(lc);
  ca.setName("console");
  fa.setContext(lc);
  fa.setName("logfile");
  LayoutWrappingEncoder<ILoggingEvent> encoder = new LayoutWrappingEncoder<>();
  encoder.setContext(lc);

  PatternLayout layout = new PatternLayout();
  layout.setPattern("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n");

  layout.setContext(lc);
  layout.start();
  encoder.setLayout(layout);

  ca.setEncoder(encoder);
  //    ca.start();
  fa.setEncoder(encoder);
  fa.start();

  Logger rootLogger = lc.getLogger(Logger.ROOT_LOGGER_NAME);
  //    rootLogger.addAppender(ca);
  rootLogger.addAppender(fa);
  rootLogger.setLevel(Level.WARN);
}
项目:logback-kafka-appender    文件:PatternBasedMessageEncoder.java   
@Override
public void start() {
    started = true;
    layout = new PatternLayout();
    layout.setContext(this.getContext());

    if (this.pattern == null || this.pattern.equals("")) {
        layout.setPattern(DEFAULT_PATTER);
        layout.start();
        return;
    }
    layout.setPattern(this.getPattern());
    layout.start();
}
项目:GabrielBot    文件:DiscordLogBack.java   
@Override
public void start() {
    patternLayout = new PatternLayout();
    patternLayout.setContext(getContext());
    patternLayout.setPattern("[%d{HH:mm:ss}] [%t/%level] [%logger{0}]: %msg");
    patternLayout.start();

    super.start();
}
项目:logback-gelf    文件:GelfLayout.java   
private PatternLayout buildPattern(final String pattern) {
    final PatternLayout patternLayout = new PatternLayout();
    patternLayout.setContext(getContext());
    patternLayout.setPattern(pattern);
    patternLayout.start();
    return patternLayout;
}
项目:cat-layout    文件:CatPatternLayoutEncoder.java   
@Override
public void start() {
    PatternLayout patternLayout = new CatPatternLayout();
    patternLayout.setContext(this.context);
    patternLayout.setPattern(getPattern());
    patternLayout.setOutputPatternAsHeader(this.outputPatternAsHeader);
    patternLayout.start();
    this.layout = patternLayout;
    this.started = true;
}
项目:cf-java-logging-support    文件:JsonEncoder.java   
private PatternLayout getLayout(ILoggingEvent event) {
    PatternLayout layout = layouts.get(getMarker(event));
    if (layout == null) {
        layout = layouts.get(Markers.DEFAULT_MARKER);
    }
    return layout;
}
项目:cf-java-logging-support    文件:JsonEncoder.java   
private void defineConverters() {
    PatternLayout.defaultConverterMap.put(ArgsConverter.WORD, ArgsConverter.class.getName());
    PatternLayout.defaultConverterMap.put(JsonMessageConverter.WORD, JsonMessageConverter.class.getName());
    PatternLayout.defaultConverterMap.put(ContextPropsConverter.WORD, ContextPropsConverter.class.getName());
    PatternLayout.defaultConverterMap.put(LogbackStacktraceConverter.WORD, LogbackStacktraceConverter.class
                                                                                                           .getName());
    PatternLayout.defaultConverterMap.put(TimestampConverter.WORD, TimestampConverter.class.getName());
    PatternLayout.defaultConverterMap.put(CategoriesConverter.WORD, CategoriesConverter.class.getName());
}
项目:emodb    文件:LogbackSlowQueryLogProvider.java   
@Override
public SlowQueryLog get() {
    Logger logger = (Logger) LoggerFactory.getLogger("sor.slow-query");
    logger.setAdditive(false);
    LoggerContext context = logger.getLoggerContext();
    logger.detachAndStopAllAppenders();

    PatternLayout logPatternLayout = new PatternLayout();
    logPatternLayout.setPattern("%-5p [%d{ISO8601," + _config.getTimeZone().getID() + "}] %m\n");
    logPatternLayout.setContext(context);
    logPatternLayout.start();

    ConsoleAppenderFactory consoleAppenderFactory = _config.getConsoleAppenderFactory();
    if (consoleAppenderFactory != null) {
        // Console is usually used only in development.  Use a synchronous appender so console output doesn't get re-ordered.
        logger.addAppender(consoleAppenderFactory.build(context, EMODB_APPLICATION_NAME, logPatternLayout));
    }

    FileAppenderFactory fileAppenderFactory = _config.getFileAppenderFactory();
    if (fileAppenderFactory != null) {
        AsyncAppender fileAsyncAppender = new AsyncAppender();
        fileAsyncAppender.addAppender(fileAppenderFactory.build(context, EMODB_APPLICATION_NAME, logPatternLayout));
        fileAsyncAppender.start();
        logger.addAppender(fileAsyncAppender);
    }

    SyslogAppenderFactory syslogAppenderFactory = _config.getSyslogAppenderFactory();
    if (syslogAppenderFactory != null) {
        AsyncAppender sysAsyncAppender = new AsyncAppender();
        sysAsyncAppender.addAppender(syslogAppenderFactory.build(context, EMODB_APPLICATION_NAME, logPatternLayout));
        sysAsyncAppender.start();
        logger.addAppender(sysAsyncAppender);
    }

    return new LogbackSlowQueryLog(logger, _config.getTooManyDeltasThreshold(), _metricRegistry);
}
项目:logback-gelf-appender    文件:GelfAppender.java   
@Override
public void start() {
    if (this.layout == null) {
        PatternLayout patternLayout = new PatternLayout();
        patternLayout.setContext(context);
        patternLayout.setPattern("%m %n");
        patternLayout.start();
        this.layout = patternLayout;
    }
    createGelfClient();
    throwableConverter.start();
    super.start();
}
项目:nexus-public    文件:NexusLayoutEncoder.java   
@Override
public void start() {
  PatternLayout patternLayout = new PatternLayout();
  patternLayout.getDefaultConverterMap().put("node", NexusNodeNameConverter.class.getName());
  patternLayout.setContext(context);
  patternLayout.setPattern(getPattern());
  patternLayout.start();
  this.layout = patternLayout;
  super.start();
}
项目:bartleby    文件:PatternLayoutEncoder.java   
@Override
public void start() {
  PatternLayout patternLayout = new PatternLayout();
  patternLayout.setContext(context);
  patternLayout.setPattern(getPattern());
  patternLayout.setOutputPatternAsHeader(outputPatternAsHeader);
  patternLayout.start();
  this.layout = patternLayout;
  super.start();
}
项目:bartleby    文件:DefaultNestedComponentRules.java   
static public void addDefaultNestedComponentRegistryRules(
    DefaultNestedComponentRegistry registry) {
  registry.add(AppenderBase.class, "layout", PatternLayout.class);
  registry.add(UnsynchronizedAppenderBase.class, "layout", PatternLayout.class);

  registry.add(AppenderBase.class, "encoder", PatternLayoutEncoder.class);
  registry.add(UnsynchronizedAppenderBase.class, "encoder", PatternLayoutEncoder.class);

  registry
      .add(EvaluatorFilter.class, "evaluator", JaninoEventEvaluator.class);

  SSLNestedComponentRegistryRules.addDefaultNestedComponentRegistryRules(registry);
}
项目:bartleby    文件:SyslogAppender.java   
public Layout<ILoggingEvent> buildLayout() {
  PatternLayout layout = new PatternLayout();
  layout.getInstanceConverterMap().put("syslogStart",
          SyslogStartConverter.class.getName());
  if (suffixPattern == null) {
    suffixPattern = DEFAULT_SUFFIX_PATTERN;
  }
  layout.setPattern(getPrefixPattern() + suffixPattern);
  layout.setContext(getContext());
  layout.start();
  return layout;
}
项目:bartleby    文件:SMTPAppender.java   
@Override
protected Layout<ILoggingEvent> makeSubjectLayout(String subjectStr) {
  if(subjectStr == null) {
    subjectStr = DEFAULT_SUBJECT_PATTERN;
  }
  PatternLayout pl = new PatternLayout();
  pl.setContext(getContext());
  pl.setPattern(subjectStr);
  // we don't want a ThrowableInformationConverter appended
  // to the end of the converter chain
  // This fixes issue LBCLASSIC-67
  pl.setPostCompileProcessor(null);
  pl.start();
  return pl;
}
项目:bartleby    文件:SMTPAppender_SubethaSMTPTest.java   
private Layout<ILoggingEvent> buildPatternLayout(LoggerContext lc) {
  PatternLayout layout = new PatternLayout();
  layout.setContext(lc);
  layout.setFileHeader(HEADER);
  layout.setPattern("%-4relative [%thread] %-5level %logger %class - %msg%n");
  layout.setFileFooter(FOOTER);
  layout.start();
  return layout;
}
项目:bartleby    文件:DilutedSMTPAppenderTest.java   
private static Layout<ILoggingEvent> buildLayout(LoggerContext lc) {
  PatternLayout layout = new PatternLayout();
  layout.setContext(lc);
  layout.setFileHeader("Some header\n");
  layout.setPattern("%-4relative [%thread] %-5level %class - %msg%n");
  layout.setFileFooter("Some footer");
  layout.start();
  return layout;
}
项目:bartleby    文件:SMTPAppender_GreenTest.java   
private Layout<ILoggingEvent> buildPatternLayout(String pattern) {
  PatternLayout layout = new PatternLayout();
  layout.setContext(loggerContext);
  layout.setFileHeader(HEADER);
  layout.setOutputPatternAsHeader(false);
  layout.setPattern(pattern);
  layout.setFileFooter(FOOTER);
  layout.start();
  return layout;
}
项目:youtrack-worklog-viewer    文件:ListenableLimitedLogMessagesAppender.java   
public void setPattern(String pattern) {
    layout = new PatternLayout();
    layout.setPattern(pattern);
    layout.setContext(context);
    layout.setOutputPatternAsHeader(true);
    layout.start();
}