-
Notifications
You must be signed in to change notification settings - Fork 155
Improve logging in channel pipeline #431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
d3bb70a
to
12896b9
Compare
if ( log.isDebugEnabled() ) | ||
{ | ||
log.debug( "Received RECORD message with metadata %s", Arrays.toString( fields ) ); | ||
log.debug( "Received RECORD message with metadata %s for handler %s", Arrays.toString( fields ), handler ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Print all incoming messages as in LoggingResponseHandler
in 1.4
readMessageBoundary = ((ByteBuf) msg).readableBytes() == 0; | ||
readMessageBoundary = chunkBuf.readableBytes() == 0; | ||
|
||
if ( log.isTraceEnabled() ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider logging chunk header and message boundary so that we can reconstruct messages from hex when debugging.
ClusterComposition cluster = response.clusterComposition(); | ||
logger.info( "Got cluster composition %s", cluster ); | ||
return cluster; | ||
return response.clusterComposition(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider logging records received from routing procedure on debug level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If debug level is enabled, then the routing table will be printed out in the record message coming from getRoutingTable procedure. Therefore there might be no need to log again in debug level.
Instead we might want a logger at INFO
level when there is a new routing table if we only have INFO level on.
@zhenlineo comments should now be fixed |
@@ -77,7 +92,7 @@ protected void encode( ChannelHandlerContext ctx, Message msg, List<Object> out | |||
|
|||
if ( log.isTraceEnabled() ) | |||
{ | |||
log.trace( "Message %s encoded as\n%s\n", msg, prettyHexDump( messageBuf ) ); | |||
log.trace( "C: %s encoded as\n%s", msg, prettyHexDump( messageBuf ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we change this to "C:\n%s" so that
- it is the same as
log.trace( "S:\n%s", prettyHexDump( msg ) );
- to avoid printing message twice as it already printed out in debug.
ClusterComposition cluster = response.clusterComposition(); | ||
logger.info( "Got cluster composition %s", cluster ); | ||
return cluster; | ||
return response.clusterComposition(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If debug level is enabled, then the routing table will be printed out in the record message coming from getRoutingTable procedure. Therefore there might be no need to log again in debug level.
Instead we might want a logger at INFO
level when there is a new routing table if we only have INFO level on.
log.info( "Got getServers response: %s", records ); | ||
if ( log.isDebugEnabled() ) | ||
{ | ||
log.debug( "Received response from %s procedure: %s", invokedProcedureString( response ), records ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sugget to change to INFO
Made all handlers in the channel pipeline prefix their log messages with channel info. Added tests and fixed issue where code would hang if channel gets disconnected during bolt handshake. Improved layout of java packages.
* `C:` and `S:` message prefixes as in other driver verisons * removed logging of chunks without headers * added trace logging of full chunks and message boundary * log raw routing procedure response on debug level
Usages replaced with `io.netty.buffer.ByteBufUtil`.
* removed double printing of outgoing message object * changed logging of routing procedure response to info level
9c4831e
to
05f5915
Compare
Made all handlers in the channel pipeline prefix their log messages with channel info. Added tests and fixed issue where code would hang if channel gets disconnected during bolt handshake. Improved layout of java packages.