org.apache.logging.log4j.Logger.getMessageFactory()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(220)

本文整理了Java中org.apache.logging.log4j.Logger.getMessageFactory()方法的一些代码示例,展示了Logger.getMessageFactory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.getMessageFactory()方法的具体详情如下:
包路径:org.apache.logging.log4j.Logger
类名称:Logger
方法名:getMessageFactory

Logger.getMessageFactory介绍

[英]Gets the message factory used to convert message Objects and Strings/CharSequences into actual log Messages. Since version 2.6, Log4j internally uses message factories that implement the MessageFactory2 interface. From version 2.6.2, the return type of this method was changed from MessageFactory to MF. The returned factory will always implement MessageFactory2, but the return type of this method could not be changed to MessageFactory2 without breaking binary compatibility.
[中]获取用于将消息对象和字符串/字符序列转换为实际日志消息的消息工厂。自版本2.6以来,Log4j在内部使用实现MessageFactory2接口的消息工厂。从版本2.6.2开始,此方法的返回类型从MessageFactory更改为MF。返回的工厂将始终实现MessageFactory2,但如果不破坏二进制兼容性,则无法将此方法的返回类型更改为MessageFactory2。

代码示例

代码示例来源:origin: netty/netty

Log4J2Logger(Logger logger) {
  super((ExtendedLogger) logger, logger.getName(), logger.getMessageFactory());
  if (VARARGS_ONLY) {
    throw new UnsupportedOperationException("Log4J2 version mismatch");
  }
}

代码示例来源:origin: redisson/redisson

Log4J2Logger(Logger logger) {
  super((ExtendedLogger) logger, logger.getName(), logger.getMessageFactory());
  if (VARARGS_ONLY) {
    throw new UnsupportedOperationException("Log4J2 version mismatch");
  }
}

代码示例来源:origin: apache/geode

public FastLogger(final Logger logger) {
 this((ExtendedLogger) logger, logger.getName(), logger.getMessageFactory());
}

代码示例来源:origin: wildfly/wildfly

Log4J2Logger(Logger logger) {
  super((ExtendedLogger) logger, logger.getName(), logger.getMessageFactory());
}

代码示例来源:origin: apache/geode

private LogWriterLogger(final Logger logger, final String connectionName,
  final boolean isSecure) {
 super((AbstractLogger) logger, logger.getName(), logger.getMessageFactory());
 logWrapper = this;
 this.connectionName = connectionName;
 loggerName = getName();
 this.isSecure = isSecure;
}

代码示例来源:origin: apache/geode

@Test
public void getLoggerReturnsLoggerWithGeodeMessageFactory() {
 Logger logger = LogService.getLogger();
 MessageFactory messageFactory = logger.getMessageFactory();
 assertThat(messageFactory).isInstanceOf(GemFireParameterizedMessageFactory.class);
}

代码示例来源:origin: apache/geode

@Test
public void getLoggerNameReturnsLoggerWithGeodeMessageFactory() {
 Logger logger = LogService.getLogger(APPLICATION_LOGGER_NAME);
 MessageFactory messageFactory = logger.getMessageFactory();
 assertThat(messageFactory).isInstanceOf(GemFireParameterizedMessageFactory.class);
}

代码示例来源:origin: io.netty/netty-common

Log4J2Logger(Logger logger) {
  super((ExtendedLogger) logger, logger.getName(), logger.getMessageFactory());
  if (VARARGS_ONLY) {
    throw new UnsupportedOperationException("Log4J2 version mismatch");
  }
}

代码示例来源:origin: apache/activemq-artemis

Log4J2Logger(Logger logger) {
  super((ExtendedLogger) logger, logger.getName(), logger.getMessageFactory());
}

代码示例来源:origin: io.bitsensor/proto

Log4J2Logger(Logger logger) {
  super((ExtendedLogger) logger, logger.getName(), logger.getMessageFactory());
  if (VARARGS_ONLY) {
    throw new UnsupportedOperationException("Log4J2 version mismatch");
  }
}

代码示例来源:origin: org.apache.ratis/ratis-proto-shaded

Log4J2Logger(Logger logger) {
  super((ExtendedLogger) logger, logger.getName(), logger.getMessageFactory());
}

代码示例来源:origin: KostyaSha/yet-another-docker-plugin

Log4J2Logger(Logger logger) {
  super((ExtendedLogger) logger, logger.getName(), logger.getMessageFactory());
  if (VARARGS_ONLY) {
    throw new UnsupportedOperationException("Log4J2 version mismatch");
  }
}

代码示例来源:origin: apache/activemq-artemis

Log4J2Logger(Logger logger) {
  super((ExtendedLogger) logger, logger.getName(), logger.getMessageFactory());
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

Log4J2Logger(Logger logger) {
  super((ExtendedLogger) logger, logger.getName(), logger.getMessageFactory());
}

代码示例来源:origin: org.apache.hbase.thirdparty/hbase-shaded-netty

Log4J2Logger(Logger logger) {
  super((ExtendedLogger) logger, logger.getName(), logger.getMessageFactory());
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

Log4J2Logger(Logger logger) {
  super((ExtendedLogger) logger, logger.getName(), logger.getMessageFactory());
}

代码示例来源:origin: com.github.emc-mongoose/mongoose-ui

public static void trace(
  final Logger logger, final Level level, final String msgPattern, final Object... args
) {
  logger.log(level, logger.getMessageFactory().newMessage(msgPattern, args), new Throwable());
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

protected void log(final Level level, final String message, final Throwable throwable) {
  final Message m = LOGGER.getMessageFactory().newMessage("{} {} {}: {}",
      getClass().getSimpleName(), getName(), message, throwable);
  LOGGER.log(level, m, throwable);
}

代码示例来源:origin: org.apache.geode/gemfire-core

private LogWriterLogger(final Logger logger, final String connectionName, final boolean isSecure) {
 super((AbstractLogger) logger, logger.getName(), logger.getMessageFactory());
 this.logWrapper = this;
 this.connectionName = connectionName;
 this.loggerName = getName();
 this.isSecure = isSecure;
}

代码示例来源:origin: emc-mongoose/mongoose

static void trace(
   final Logger logger,
   final Level level,
   final Throwable e,
   final String msgPattern,
   final Object... args) {
  logger.log(level, logger.getMessageFactory().newMessage(msgPattern + ": " + e, args), e);
 }
}

相关文章