Table of Contents

About

Web - Log (Http log) in Vert.x

LoggerHandler is a handler which logs request information to the Vert.x logger.

Example

Example with the DEFAULT LoggerFormat.

Vertx vertx = Vertx.vertx();
HttpServer httpServer = vertx.createHttpServer();
Router router = Router.router(vertx);

// The handler
router.route().handler(LoggerHandler.create(LoggerFormat.DEFAULT));

httpServer.requestHandler(router::accept).listen(8080);

Format

Note: LoggerHandler is a static factory that returns the implementation LoggerHandlerImpl (code).

It support only three formats that are define via the LoggerFormat.

In version 4, you should be able to override the log method to add your own format. See issue

Format:

remote-client - - [timestamp] "method uri version" status content-length "referrer" "user-agent"

  • SHORT
remote-client - method uri version status content-length duration ms

  • TINY
method uri status - content-length duration