本文整理汇总了Java中io.dropwizard.logging.layout.LayoutFactory类的典型用法代码示例。如果您正苦于以下问题:Java LayoutFactory类的具体用法?Java LayoutFactory怎么用?Java LayoutFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LayoutFactory类属于io.dropwizard.logging.layout包,在下文中一共展示了LayoutFactory类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: build
import io.dropwizard.logging.layout.LayoutFactory; //导入依赖的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: build
import io.dropwizard.logging.layout.LayoutFactory; //导入依赖的package包/类
public Appender<ILoggingEvent> build(
LoggerContext context,
String applicationName,
LayoutFactory<ILoggingEvent> layoutFactory,
LevelFilterFactory<ILoggingEvent> levelFilterFactory,
AsyncAppenderFactory<ILoggingEvent> asyncAppenderFactory
) {
final LoggingEventCompositeJsonEncoder encoder = new LoggingEventCompositeJsonEncoder();
encoder.setContext(context);
encoder.getProviders().addProvider(withPattern("{ \"type\": \"system\" }", new LoggingEventPatternJsonProvider(), context));
encoder.getProviders().addProvider(withName("timestamp", new LoggingEventFormattedTimestampJsonProvider(), context));
encoder.getProviders().addProvider(new LogLevelJsonProvider() );
encoder.getProviders().addProvider(new MessageJsonProvider() );
encoder.getProviders().addProvider(new StackTraceJsonProvider() );
encoder.start();
final ConsoleAppender<ILoggingEvent> appender = new ConsoleAppender<>();
appender.setContext(context);
appender.setEncoder(encoder);
appender.start();
return wrapAsync(appender, asyncAppenderFactory);
}
开发者ID:atgse,项目名称:sam,代码行数:27,代码来源:JsonLogAppender.java
示例3: build
import io.dropwizard.logging.layout.LayoutFactory; //导入依赖的package包/类
@Override
public Appender<ILoggingEvent> build(LoggerContext context,
String applicationName,
LayoutFactory<ILoggingEvent> layoutFactory,
LevelFilterFactory<ILoggingEvent> levelFilterFactory,
AsyncAppenderFactory<ILoggingEvent> asyncAppenderFactory) {
final Syslog4jAppender<ILoggingEvent> syslogAppender = new Syslog4jAppender<>();
syslogAppender.setContext(context);
syslogAppender.setLayout(buildLayout(context, layoutFactory));
syslogAppender.setName("SYSLOG-TLS");
final SSLTCPNetSyslogConfig syslogConfig = new SSLTCPNetSyslogConfig();
syslogConfig.setIdent(ident);
syslogConfig.setHost(host);
syslogConfig.setPort(port);
syslogConfig.setFacility(facility);
syslogConfig.setSendLocalName(sendLocalName);
syslogAppender.setSyslogConfig(syslogConfig);
syslogAppender.addFilter(levelFilterFactory.build(threshold));
syslogAppender.start();
return syslogAppender;
}
开发者ID:dc-square,项目名称:dropwizard-papertrail,代码行数:26,代码来源:PapertrailAppenderFactory.java
示例4: build
import io.dropwizard.logging.layout.LayoutFactory; //导入依赖的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
示例5: build
import io.dropwizard.logging.layout.LayoutFactory; //导入依赖的package包/类
public Appender<IAccessEvent> build(
LoggerContext context,
String applicationName,
LayoutFactory<IAccessEvent> layoutFactory,
LevelFilterFactory<IAccessEvent> levelFilterFactory,
AsyncAppenderFactory<IAccessEvent> asyncAppenderFactory
) {
final AccessEventCompositeJsonEncoder encoder = new AccessEventCompositeJsonEncoder();
encoder.setContext(context);
encoder.getProviders().addProvider(withPattern("{ \"type\": \"access\" }", new AccessEventPatternJsonProvider(), context));
encoder.getProviders().addProvider(withName("timestamp" ,new AccessEventFormattedTimestampJsonProvider(), context));
encoder.getProviders().addProvider(withName("status", new StatusCodeJsonProvider(), context));
encoder.getProviders().addProvider(withName("method", new MethodJsonProvider(), context));
encoder.getProviders().addProvider(withName("protocol", new ProtocolJsonProvider(), context));
encoder.getProviders().addProvider(withName("uri", new RequestedUriJsonProvider(), context));
encoder.getProviders().addProvider(withName("client-ip", new RemoteHostJsonProvider(), context));
encoder.getProviders().addProvider(withName("user", new RemoteUserJsonProvider(), context));
encoder.getProviders().addProvider(withName("elapsed-time", new ElapsedTimeJsonProvider(), context));
encoder.getProviders().addProvider(withName("content-length", new ContentLengthJsonProvider(), context));
encoder.getProviders().addProvider(withPattern("{ \"user-agent\": \"%i{User-Agent}\" }", new AccessEventPatternJsonProvider(), context));
encoder.start();
final ConsoleAppender<IAccessEvent> appender = new ConsoleAppender<>();
appender.setContext(context);
appender.setEncoder(encoder);
appender.start();
return wrapAsync(appender, asyncAppenderFactory);
}
开发者ID:atgse,项目名称:sam,代码行数:32,代码来源:JsonAccessLogAppender.java
示例6: build
import io.dropwizard.logging.layout.LayoutFactory; //导入依赖的package包/类
public Appender build(LoggerContext loggerContext, String s, LayoutFactory layoutFactory, LevelFilterFactory levelFilterFactory, AsyncAppenderFactory asyncAppenderFactory) {
final TextAreaAppender appender = new TextAreaAppender();
appender.setName("textarea-appender");
appender.setContext(loggerContext);
appender.start();
return wrapAsync(appender, asyncAppenderFactory);
}
开发者ID:Krillsson,项目名称:sys-api,代码行数:8,代码来源:TextAreaAppenderFactory.java
示例7: build
import io.dropwizard.logging.layout.LayoutFactory; //导入依赖的package包/类
@Override
public Appender build(LoggerContext context, String s, LayoutFactory layoutFactory,
LevelFilterFactory levelFilterFactory,
AsyncAppenderFactory asyncAppenderFactory) {
final LogstashSocketAppender appender = new LogstashSocketAppender();
appender.setName("logstash-socket-appender");
appender.setContext(context);
appender.setHost(host);
appender.setPort(port);
appender.setIncludeCallerData(includeCallerData);
appender.setIncludeMdc(includeMdc);
appender.setIncludeContext(includeContext);
if (customFields != null) {
LogstashAppenderFactoryHelper
.getCustomFieldsFromHashMap(customFields)
.ifPresent(appender::setCustomFields);
}
if (fieldNames != null) {
appender.setFieldNames(LogstashAppenderFactoryHelper.getFieldNamesFromHashMap(fieldNames));
}
appender.addFilter(levelFilterFactory.build(threshold));
appender.start();
return wrapAsync(appender, asyncAppenderFactory);
}
开发者ID:Wikia,项目名称:dropwizard-logstash-encoder,代码行数:31,代码来源:LogstashSocketAppenderFactory.java
示例8: build
import io.dropwizard.logging.layout.LayoutFactory; //导入依赖的package包/类
@Override
public Appender build(LoggerContext context, String s, LayoutFactory layoutFactory,
LevelFilterFactory levelFilterFactory,
AsyncAppenderFactory asyncAppenderFactory) {
final LogstashTcpSocketAppender appender = new LogstashTcpSocketAppender();
final LogstashEncoder encoder = new LogstashEncoder();
appender.setName("logstash-tcp-appender");
appender.setContext(context);
appender.addDestinations(new InetSocketAddress(host, port));
appender.setIncludeCallerData(includeCallerData);
appender.setQueueSize(queueSize);
encoder.setIncludeContext(includeContext);
encoder.setIncludeMdc(includeMdc);
encoder.setIncludeCallerData(includeCallerData);
if (customFields != null) {
LogstashAppenderFactoryHelper
.getCustomFieldsFromHashMap(customFields)
.ifPresent(encoder::setCustomFields);
}
if (fieldNames != null) {
encoder.setFieldNames(LogstashAppenderFactoryHelper.getFieldNamesFromHashMap(fieldNames));
}
appender.setEncoder(encoder);
appender.addFilter(levelFilterFactory.build(threshold));
encoder.start();
appender.start();
return wrapAsync(appender, asyncAppenderFactory);
}
开发者ID:Wikia,项目名称:dropwizard-logstash-encoder,代码行数:35,代码来源:LogstashTcpAppenderFactory.java
示例9: build
import io.dropwizard.logging.layout.LayoutFactory; //导入依赖的package包/类
@Override
public Appender<ILoggingEvent> build(LoggerContext context,
String applicationName,
LayoutFactory<ILoggingEvent> layoutFactory,
LevelFilterFactory<ILoggingEvent> levelFilterFactory,
AsyncAppenderFactory<ILoggingEvent> asyncAppenderFactory) {
checkNotNull(context);
final SentryAppender appender = new SentryAppender();
appender.setName(APPENDER_NAME);
appender.setContext(context);
appender.setDsn(dsn);
environment.ifPresent(appender::setEnvironment);
extraTags.ifPresent(appender::setExtraTags);
ravenFactory.ifPresent(appender::setRavenFactory);
release.ifPresent(appender::setRelease);
serverName.ifPresent(appender::setServerName);
tags.ifPresent(appender::setTags);
appender.addFilter(levelFilterFactory.build(threshold));
getFilterFactories().stream().forEach(f -> appender.addFilter(f.build()));
appender.start();
final Appender<ILoggingEvent> asyncAppender = wrapAsync(appender, asyncAppenderFactory, context);
addDroppingRavenLoggingFilter(asyncAppender);
return asyncAppender;
}
开发者ID:tradier,项目名称:dropwizard-raven,代码行数:30,代码来源:RavenAppenderFactory.java
注:本文中的io.dropwizard.logging.layout.LayoutFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论