Vert.x - Logger

Java Conceptuel Diagram

About

logging in Vertx is managed by the Vertx Logger

The Vertx logger is a facade for logging system. It uses the JUL logger as default logging engine. You may change it

Example

You can set Vertx to use Log4j via the vertx.logger-delegate-factory-class-name system property.

For instance in the Launcher

public class MainLauncher extends io.vertx.core.Launcher {
  static {
      System.setProperty("vertx.logger-delegate-factory-class-name", "io.vertx.core.logging.Log4j2LogDelegateFactory");
  }
  ...
}

Management

Change

By default, Vertx uses the JUL logger. If you want to use another logger, you need to perform this steps:

  • the system property called vertx.logger-delegate-factory-class-name must be set to the class name of the delegate for your logging system.
  • the logging system jar must be added as a dependency (ie must be in the classpath)

Example of how to set the system property by logging system:

java -Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.SLF4JLogDelegateFactory -Dlog4j.configuration=log4j.xml
System.setProperty("vertx.logger-delegate-factory-class-name", "io.vertx.core.logging.SLF4JLogDelegateFactory");
// version 1
java -Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.Log4jLogDelegateFactory -Dlog4j.configuration=log4j.xml
// version 2
java -Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.Log4j2LogDelegateFactory -Dlog4j.configuration=log4j.xml
java -Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.SLF4JLogDelegateFactory -Dlogback.configurationFile=logback.xml

Web Log

See Vert.x - Web Logger

Documentation / Reference





Discover More
Java Conceptuel Diagram
Vert.x - Web Logger

in Vert.x io/vertx/ext/web/handler/LoggerHandlerLoggerHandler is a handler which logs request information to the Vert.x logger. Example with the DEFAULT LoggerFormat....



Share this page:
Follow us:
Task Runner