类io.netty.util.internal.logging.Log4J2LoggerFactory源码实例Demo

下面列出了怎么用io.netty.util.internal.logging.Log4J2LoggerFactory的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: besu   文件: Besu.java
private static Logger setupLogging() {
  InternalLoggerFactory.setDefaultFactory(Log4J2LoggerFactory.INSTANCE);
  try {
    System.setProperty(
        "vertx.logger-delegate-factory-class-name",
        "io.vertx.core.logging.Log4j2LogDelegateFactory");
  } catch (SecurityException e) {
    System.out.println(
        "Could not set logging system property as the security manager prevented it:"
            + e.getMessage());
  }

  final Logger logger = getLogger();
  Thread.setDefaultUncaughtExceptionHandler(
      (thread, error) ->
          logger.error("Uncaught exception in thread \"" + thread.getName() + "\"", error));
  Thread.currentThread()
      .setUncaughtExceptionHandler(
          (thread, error) ->
              logger.error("Uncaught exception in thread \"" + thread.getName() + "\"", error));
  return logger;
}
 
源代码2 项目: VX-API-Gateway   文件: VxApiLauncher.java
public static void main(String[] args) {
	String thisVertxName = UUID.randomUUID().toString() + LocalTime.now().getNano();
	// 设置当前系统Vertx的唯一标识
	System.setProperty("thisVertxName", thisVertxName);
	InternalLoggerFactory.setDefaultFactory(Log4J2LoggerFactory.INSTANCE);
	System.setProperty("vertx.logger-delegate-factory-class-name", "io.vertx.core.logging.Log4j2LogDelegateFactory");
	System.setProperty("vertx.disableDnsResolver", "true");
	new VxApiLauncher().dispatch(args);
}
 
 类所在包
 类方法
 同包方法