Skip to content

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

Merged
merged 6 commits into from
Nov 23, 2017

Conversation

lutovich
Copy link
Contributor

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.

@lutovich lutovich requested a review from zhenlineo November 20, 2017 09:50
@lutovich lutovich force-pushed the 1.5-improve-logging branch 2 times, most recently from d3bb70a to 12896b9 Compare November 20, 2017 13:05
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 );
Copy link
Contributor Author

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() )
Copy link
Contributor Author

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();
Copy link
Contributor Author

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

Copy link
Contributor

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.

@lutovich
Copy link
Contributor Author

@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 ) );
Copy link
Contributor

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();
Copy link
Contributor

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 );
Copy link
Contributor

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
@lutovich lutovich force-pushed the 1.5-improve-logging branch from 9c4831e to 05f5915 Compare November 23, 2017 10:30
@zhenlineo zhenlineo merged commit 0bfa545 into neo4j:1.5 Nov 23, 2017
@lutovich lutovich deleted the 1.5-improve-logging branch November 23, 2017 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants