本文整理汇总了Java中net.logstash.logback.composite.loggingevent.MessageJsonProvider类的典型用法代码示例。如果您正苦于以下问题:Java MessageJsonProvider类的具体用法?Java MessageJsonProvider怎么用?Java MessageJsonProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageJsonProvider类属于net.logstash.logback.composite.loggingevent包,在下文中一共展示了MessageJsonProvider类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import net.logstash.logback.composite.loggingevent.MessageJsonProvider; //导入依赖的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);
}
示例2: getCommonJsonProviders
import net.logstash.logback.composite.loggingevent.MessageJsonProvider; //导入依赖的package包/类
private static LoggingEventJsonProviders getCommonJsonProviders(
final LoggerContext loggerContext) {
final LoggingEventJsonProviders jsonProviders = new LoggingEventJsonProviders();
jsonProviders.addPattern(new LoggingEventPatternJsonProvider());
jsonProviders.addArguments(new ArgumentsJsonProvider());
jsonProviders.addMessage(new MessageJsonProvider());
jsonProviders.addContext(new ContextJsonProvider<ILoggingEvent>());
jsonProviders.addMdc(new MdcJsonProvider());
jsonProviders.setContext(loggerContext);
return jsonProviders;
}