本文整理汇总了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());
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}