本文整理匯總了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;
}