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


Java Layout类代码示例

本文整理汇总了Java中ch.qos.logback.core.Layout的典型用法代码示例。如果您正苦于以下问题:Java Layout类的具体用法?Java Layout怎么用?Java Layout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Layout类属于ch.qos.logback.core包,在下文中一共展示了Layout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGettersSetters

import ch.qos.logback.core.Layout; //导入依赖的package包/类
@Test
public void testGettersSetters() {
    @SuppressWarnings("unchecked")
    final Layout<ILoggingEvent> layout = mock(Layout.class);
    final AWSLogs awsLogs = mock(AWSLogs.class);
    final String logGroupName = "myGroup";
    final String logStreamName = "myStream";

    final CloudWatchAppender appender = new CloudWatchAppender();
    appender.setLayout(layout);
    appender.setAwsLogs(awsLogs);
    appender.setLogGroupName(logGroupName);
    appender.setLogStreamName(logStreamName);

    assertEquals(layout, appender.getLayout());
    assertEquals(awsLogs, appender.getAwsLogs());
    assertEquals(logGroupName, appender.getLogGroupName());
    assertEquals(logStreamName, appender.getLogStreamName());
}
 
开发者ID:minijax,项目名称:minijax,代码行数:20,代码来源:CloudWatchAppenderTest.java

示例2: build

import ch.qos.logback.core.Layout; //导入依赖的package包/类
@Override
public Appender<ILoggingEvent> build(LoggerContext context, String s, Layout<ILoggingEvent> layout) {
    Preconditions.checkNotNull(context);
    WiretapAppender appender = new WiretapAppender();

    final PatternLayoutEncoder patternEncoder = new PatternLayoutEncoder();
    patternEncoder.setContext(context);
    patternEncoder.setPattern("%-5p [%thread] [%d] %c: %m%n%rEx");
    patternEncoder.start();

    appender.setContext(context);
    appender.setName("wiretap-appender");
    appender.setEncoder(patternEncoder);

    addThresholdFilter(appender, threshold);
    appender.start();

    return wrapAsync(appender);
}
 
开发者ID:Quiq,项目名称:dropwizard-wiretap,代码行数:20,代码来源:WiretapAppenderFactory.java

示例3: build

import ch.qos.logback.core.Layout; //导入依赖的package包/类
@Override
public Appender<ILoggingEvent> build(LoggerContext context, String applicationName, Layout<ILoggingEvent> layout) {
    final GelfAppender<ILoggingEvent> appender = new GelfAppender<>();

    appender.setName("gelf-appender");
    appender.setContext(context);
    appender.getConfig().setHost(server.getHostText());

    if (server.hasPort()) {
        appender.getConfig().setPort(server.getPort());
    }

    appender.getConfig().getDefaultFields().put(GelfTargetConfig.FIELD_FACILITY, applicationName);
    appender.getConfig().getDefaultFields().putAll(defaultFields);
    if(!additionalFields.isEmpty())
    {
        appender.getConfig().getAdditionalFields().clear();
        appender.getConfig().getAdditionalFields().putAll(additionalFields);
    }

    addThresholdFilter(appender, threshold);
    appender.start();

    return wrapAsync(appender);
}
 
开发者ID:reines,项目名称:dropwizard-logging-gelf,代码行数:26,代码来源:GelfAppenderFactory.java

示例4: build

import ch.qos.logback.core.Layout; //导入依赖的package包/类
@Override
public Appender<ILoggingEvent> build(LoggerContext context, String applicationName, Layout<ILoggingEvent> layout) {
    final LogglyAppender<ILoggingEvent> appender = new LogglyAppender<>();

    final String tagName = tag.or(applicationName);

    appender.setName("loggly-appender");
    appender.setContext(context);
    appender.setEndpointUrl(String.format(ENDPOINT_URL_TEMPLATE, server, token, tagName));
    appender.setLayout(layout == null ? buildLayout(context) : layout);

    addThresholdFilter(appender, threshold);
    appender.start();

    return wrapAsync(appender);
}
 
开发者ID:reines,项目名称:dropwizard-logging-loggly,代码行数:17,代码来源:LogglyAppenderFactory.java

示例5: setLayout

import ch.qos.logback.core.Layout; //导入依赖的package包/类
/**
 * レイアウトの設定<br>
 * 通常は {@link #setEncoder(Encoder)}を利用する
 *
 * @param layout {@code <layout>}
 */
public void setLayout(Layout<E> layout) {
	LayoutWrappingEncoder<E> lwe = new LayoutWrappingEncoder<>();
	lwe.setLayout(layout);
	lwe.setContext(this.context);
	this.encoder = lwe;
}
 
开发者ID:future-architect,项目名称:uroborosql,代码行数:13,代码来源:AbstractEncodedAppender.java

示例6: createText

import ch.qos.logback.core.Layout; //导入依赖的package包/类
private String createText(ILoggingEvent event) {
    Layout<ILoggingEvent> layout = this.layout;
    if (layout == null) {
        return event.getFormattedMessage();
    } else {
        return layout.doLayout(event);
    }
}
 
开发者ID:dwango,项目名称:slack-webhook-appender,代码行数:9,代码来源:SlackWebhookAppender.java

示例7: buildLayout

import ch.qos.logback.core.Layout; //导入依赖的package包/类
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;
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:13,代码来源:SyslogAppender.java

示例8: makeSubjectLayout

import ch.qos.logback.core.Layout; //导入依赖的package包/类
@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;
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:16,代码来源:SMTPAppender.java

示例9: buildPatternLayout

import ch.qos.logback.core.Layout; //导入依赖的package包/类
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;
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:10,代码来源:SMTPAppender_SubethaSMTPTest.java

示例10: buildHTMLLayout

import ch.qos.logback.core.Layout; //导入依赖的package包/类
private Layout<ILoggingEvent> buildHTMLLayout(LoggerContext lc) {
  HTMLLayout layout = new HTMLLayout();
  layout.setContext(lc);
  // layout.setFileHeader(HEADER);
  layout.setPattern("%level%class%msg");
  // layout.setFileFooter(FOOTER);
  layout.start();
  return layout;
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:10,代码来源:SMTPAppender_SubethaSMTPTest.java

示例11: buildLayout

import ch.qos.logback.core.Layout; //导入依赖的package包/类
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;
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:10,代码来源:DilutedSMTPAppenderTest.java

示例12: buildPatternLayout

import ch.qos.logback.core.Layout; //导入依赖的package包/类
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;
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:11,代码来源:SMTPAppender_GreenTest.java

示例13: buildHTMLLayout

import ch.qos.logback.core.Layout; //导入依赖的package包/类
private Layout<ILoggingEvent> buildHTMLLayout() {
  HTMLLayout layout = new HTMLLayout();
  layout.setContext(loggerContext);
  layout.setPattern("%level%class%msg");
  layout.start();
  return layout;
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:8,代码来源:SMTPAppender_GreenTest.java

示例14: makeSubjectLayout

import ch.qos.logback.core.Layout; //导入依赖的package包/类
@Override
protected Layout<IAccessEvent> makeSubjectLayout(String subjectStr) {
  if(subjectStr == null) {
    subjectStr = DEFAULT_SUBJECT_PATTERN;
  }
  PatternLayout pl = new PatternLayout();
  pl.setPattern(subjectStr);
  pl.start();
  return pl;
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:11,代码来源:SMTPAppender.java

示例15: FluentDaemonAppender

import ch.qos.logback.core.Layout; //导入依赖的package包/类
FluentDaemonAppender(String tag, String label, String remoteHost,
                     int port, Layout<E> layout, int maxQueueSize) {
    super(maxQueueSize);
    this.tag = tag;
    this.label = label;
    this.remoteHost = remoteHost;
    this.port = port;
    this.layout = layout;
}
 
开发者ID:linux-china,项目名称:logback-fluentd-appender,代码行数:10,代码来源:FluentLogbackAppender.java


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