Top Description Fields Constructors Methods
reactor.netty.transport.logging

pack-priv final Class ReactorNettyLoggingHandler

extends LoggingHandler
Class Inheritance
Imports
java.nio.charset.Charset, java.util.Objects, io.netty.buffer.ByteBuf, .ByteBufHolder, io.netty.channel.Channel, .ChannelHandlerContext, io.netty.handler.logging.ByteBufFormat, .LogLevel, .LoggingHandler, reactor.netty.ChannelOperationsId, .Connection

Extends LoggingHandler in order to provide extended connection id, which in case of HTTP adds the serial number of the request received on that connection.

In case of AdvancedByteBufFormat#TEXTUAL logs all events in a textual representation, so it's human readable and less verbose.

Hint: Logger escapes newlines as "\n" to reduce output.

Authors
Maximilian Goeke, Violeta Georgieva
Since
1.0.0

Field Summary

Modifier and TypeField and Description
private final AdvancedByteBufFormat
pack-priv static final char
pack-priv static final char
private final Charset
private final String
pack-priv static final String
pack-priv static final int
pack-priv static final char
Inherited from io.netty.handler.logging.LoggingHandler:
internalLevellogger

Constructor Summary

AccessConstructor and Description
pack-priv
ReactorNettyLoggingHandler(String
the name of the class to use for the logger
name
,
LogLevel
the log level
level
,
AdvancedByteBufFormat
the byte buffer format
byteBufFormat
)

Creates a new instance with the specified logger name, level and byte buffer format.

pack-priv
ReactorNettyLoggingHandler(final String
the name of the class to use for the logger
name
,
final LogLevel
the log level
level
,
final Charset
the charset used to decode the ByteBuf
charset
)

Creates a new instance with the specified logger name, level and charset.

Method Summary

Modifier and TypeMethod and Description
public ByteBufFormat
byteBufFormat()

Overrides io.netty.handler.logging.LoggingHandler.byteBufFormat.

Returns the ByteBufFormat that this handler uses to log
private String
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
protected String
format(ChannelHandlerContext ctx, String
the name of the event
eventName
)

Overrides io.netty.handler.logging.LoggingHandler.format.

Formats an event and returns the formatted message.
protected String
format(ChannelHandlerContext ctx, String
the name of the event
eventName
,
Object
the argument of the event
arg
)

Overrides io.netty.handler.logging.LoggingHandler.format.

Formats an event and returns the formatted message.
protected String
format(ChannelHandlerContext ctx, String
the name of the event
eventName
,
Object
the first argument of the event
firstArg
,
Object
the second argument of the event
secondArg
)

Overrides io.netty.handler.logging.LoggingHandler.format.

Formats an event and returns the formatted message.
private String
formatByteBuf(ChannelHandlerContext ctx, String eventName, ByteBuf msg)

Hides io.netty.handler.logging.LoggingHandler.formatByteBuf.

Generates the default log message of the specified event whose argument is a ByteBuf.
private String
formatByteBufHolder(ChannelHandlerContext ctx, String eventName, ByteBufHolder msg)

Hides io.netty.handler.logging.LoggingHandler.formatByteBufHolder.

Generates the default log message of the specified event whose argument is a ByteBufHolder.
private String
formatSimple(ChannelHandlerContext ctx, String eventName, Object msg)

Hides io.netty.handler.logging.LoggingHandler.formatSimple.

Generates the default log message of the specified event whose argument is an arbitrary object.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
Inherited from io.netty.handler.logging.LoggingHandler:
bindchannelActivechannelInactivechannelReadchannelReadCompletechannelRegisteredchannelUnregisteredchannelWritabilityChangedcloseconnectderegisterdisconnectexceptionCaughtflushleveluserEventTriggeredwrite

Field Detail

byteBufFormatback to summary
private final AdvancedByteBufFormat byteBufFormat

Hides io.netty.handler.logging.LoggingHandler.byteBufFormat.

CHANNEL_ID_PREFIXback to summary
pack-priv static final char CHANNEL_ID_PREFIX
CHANNEL_ID_SUFFIXback to summary
pack-priv static final char CHANNEL_ID_SUFFIX
charsetback to summary
private final Charset charset
nameback to summary
private final String name
ORIGINAL_CHANNEL_ID_PREFIXback to summary
pack-priv static final String ORIGINAL_CHANNEL_ID_PREFIX
ORIGINAL_CHANNEL_ID_PREFIX_LENGTHback to summary
pack-priv static final int ORIGINAL_CHANNEL_ID_PREFIX_LENGTH
TRACE_ID_PREFIXback to summary
pack-priv static final char TRACE_ID_PREFIX

Constructor Detail

ReactorNettyLoggingHandlerback to summary
pack-priv ReactorNettyLoggingHandler(String name, LogLevel level, AdvancedByteBufFormat byteBufFormat)

Creates a new instance with the specified logger name, level and byte buffer format.

Parameters
name:String

the name of the class to use for the logger

level:LogLevel

the log level

byteBufFormat:AdvancedByteBufFormat

the byte buffer format

ReactorNettyLoggingHandlerback to summary
pack-priv ReactorNettyLoggingHandler(final String name, final LogLevel level, final Charset charset)

Creates a new instance with the specified logger name, level and charset. The byte buffer format is AdvancedByteBufFormat#TEXTUAL

Parameters
name:String

the name of the class to use for the logger

level:LogLevel

the log level

charset:Charset

the charset used to decode the ByteBuf

Method Detail

byteBufFormatback to summary
public ByteBufFormat byteBufFormat()

Overrides io.netty.handler.logging.LoggingHandler.byteBufFormat.

Doc from io.netty.handler.logging.LoggingHandler.byteBufFormat.

Returns the ByteBufFormat that this handler uses to log

Annotations
@Override
channelStringback to summary
private String channelString(Channel channel)
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
formatback to summary
protected String format(ChannelHandlerContext ctx, String eventName)

Overrides io.netty.handler.logging.LoggingHandler.format.

Doc from io.netty.handler.logging.LoggingHandler.format.

Formats an event and returns the formatted message.

Parameters
eventName:String

the name of the event

Annotations
@Override
formatback to summary
protected String format(ChannelHandlerContext ctx, String eventName, Object arg)

Overrides io.netty.handler.logging.LoggingHandler.format.

Doc from io.netty.handler.logging.LoggingHandler.format.

Formats an event and returns the formatted message.

Parameters
eventName:String

the name of the event

arg:Object

the argument of the event

Annotations
@Override
formatback to summary
protected String format(ChannelHandlerContext ctx, String eventName, Object firstArg, Object secondArg)

Overrides io.netty.handler.logging.LoggingHandler.format.

Doc from io.netty.handler.logging.LoggingHandler.format.

Formats an event and returns the formatted message. This method is currently only used for formatting ChannelOutboundHandler#connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise).

Parameters
eventName:String

the name of the event

firstArg:Object

the first argument of the event

secondArg:Object

the second argument of the event

Annotations
@Override
formatByteBufback to summary
private String formatByteBuf(ChannelHandlerContext ctx, String eventName, ByteBuf msg)

Hides io.netty.handler.logging.LoggingHandler.formatByteBuf.

Doc from io.netty.handler.logging.LoggingHandler.formatByteBuf.

Generates the default log message of the specified event whose argument is a ByteBuf.

formatByteBufHolderback to summary
private String formatByteBufHolder(ChannelHandlerContext ctx, String eventName, ByteBufHolder msg)

Hides io.netty.handler.logging.LoggingHandler.formatByteBufHolder.

Doc from io.netty.handler.logging.LoggingHandler.formatByteBufHolder.

Generates the default log message of the specified event whose argument is a ByteBufHolder.

formatSimpleback to summary
private String formatSimple(ChannelHandlerContext ctx, String eventName, Object msg)

Hides io.netty.handler.logging.LoggingHandler.formatSimple.

Doc from io.netty.handler.logging.LoggingHandler.formatSimple.

Generates the default log message of the specified event whose argument is an arbitrary object.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override