io.netty.util.internal.logging.Log4J2LoggerFactory Java Examples

The following examples show how to use io.netty.util.internal.logging.Log4J2LoggerFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Besu.java    From besu with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #2
Source File: VxApiLauncher.java    From VX-API-Gateway with MIT License 5 votes vote down vote up
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);
}