Class HttpAccessLogHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelDuplexHandler
io.micronaut.http.server.netty.handler.accesslog.HttpAccessLogHandler
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler, io.netty.channel.ChannelOutboundHandler

@Sharable public class HttpAccessLogHandler extends io.netty.channel.ChannelDuplexHandler
Logging handler for HTTP access logs. Access logs will be logged at info level.
Since:
2.0
Author:
croudet
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

    io.netty.channel.ChannelHandler.Sharable
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The default logger name.
  • Constructor Summary

    Constructors
    Constructor
    Description
    HttpAccessLogHandler(String loggerName, String spec)
    Creates a HttpAccessLogHandler.
    HttpAccessLogHandler(String loggerName, String spec, Predicate<String> uriInclusion)
    Creates a HttpAccessLogHandler.
    HttpAccessLogHandler(org.slf4j.Logger logger, String spec)
    Creates a HttpAccessLogHandler.
    HttpAccessLogHandler(org.slf4j.Logger logger, String spec, Predicate<String> uriInclusion)
    Creates a HttpAccessLogHandler.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg)
     
    void
    write(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise)
     

    Methods inherited from class io.netty.channel.ChannelDuplexHandler

    bind, close, connect, deregister, disconnect, flush, read

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

    channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, handlerAdded, handlerRemoved, isSharable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.netty.channel.ChannelHandler

    handlerAdded, handlerRemoved
  • Field Details

  • Constructor Details

    • HttpAccessLogHandler

      public HttpAccessLogHandler(String loggerName, String spec)
      Creates a HttpAccessLogHandler.
      Parameters:
      loggerName - A logger name.
      spec - The log format specification.
    • HttpAccessLogHandler

      public HttpAccessLogHandler(String loggerName, String spec, Predicate<String> uriInclusion)
      Creates a HttpAccessLogHandler.
      Parameters:
      loggerName - A logger name.
      spec - The log format specification.
      uriInclusion - A filtering Predicate that will be checked per URI.
    • HttpAccessLogHandler

      public HttpAccessLogHandler(org.slf4j.Logger logger, String spec)
      Creates a HttpAccessLogHandler.
      Parameters:
      logger - A logger. Will log at info level.
      spec - The log format specification.
    • HttpAccessLogHandler

      public HttpAccessLogHandler(org.slf4j.Logger logger, String spec, Predicate<String> uriInclusion)
      Creates a HttpAccessLogHandler.
      Parameters:
      logger - A logger. Will log at info level.
      spec - The log format specification.
      uriInclusion - A filtering Predicate that will be checked per URI.
  • Method Details

    • channelRead

      public void channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) throws io.netty.handler.codec.http2.Http2Exception
      Specified by:
      channelRead in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelRead in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      io.netty.handler.codec.http2.Http2Exception
    • write

      public void write(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise) throws Exception
      Specified by:
      write in interface io.netty.channel.ChannelOutboundHandler
      Overrides:
      write in class io.netty.channel.ChannelDuplexHandler
      Throws:
      Exception