Skip to content

Commit

Permalink
Integrate bolt logging with database
Browse files Browse the repository at this point in the history
This commit adds two internal settings for bolt logging:
 * `unsupported.dbms.logs.bolt.enabled` with default value "false"
 * `unsupported.dbms.logs.bolt.path` with default value "bolt.log"

and makes logging infrastructure use same files system, executor and
paths as the database. Classes are moved to a different package.
Extracted a bolt logger interface and added no-op implementation
to use when bolt message logging is turned off.
  • Loading branch information
lutovich authored and praveenag committed Sep 4, 2017
1 parent c79c892 commit e09963e
Show file tree
Hide file tree
Showing 32 changed files with 1,084 additions and 380 deletions.
21 changes: 14 additions & 7 deletions community/bolt/src/main/java/org/neo4j/bolt/BoltChannel.java
Expand Up @@ -25,6 +25,8 @@

import java.net.SocketAddress;

import org.neo4j.bolt.logging.BoltMessageLogger;

/**
* A channel through which Bolt messaging can occur.
*/
Expand Down Expand Up @@ -65,14 +67,19 @@ public BoltMessageLogger log()
@Override
public void close()
{
messageLogger.serverEvent( "CLOSE" );
try
{
rawChannel().close();
}
catch ( Exception e )
Channel rawChannel = rawChannel();
if ( rawChannel.isOpen() )
{
//
messageLogger.serverEvent( "CLOSE" );
try
{
// closing of channel is asynchronous, wait for it to complete
rawChannel.close().sync();
}
catch ( InterruptedException e )
{
Thread.currentThread().interrupt();
}
}
}

Expand Down
Expand Up @@ -28,6 +28,7 @@
import java.util.function.Function;
import java.util.stream.Collectors;

import org.neo4j.bolt.logging.BoltMessageLogging;
import org.neo4j.bolt.security.auth.Authentication;
import org.neo4j.bolt.security.auth.BasicAuthentication;
import org.neo4j.bolt.transport.BoltMessagingProtocolHandler;
Expand All @@ -48,6 +49,7 @@
import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.helpers.ListenSocketAddress;
import org.neo4j.helpers.Service;
import org.neo4j.io.fs.FileSystemAbstraction;
import org.neo4j.kernel.api.bolt.BoltConnectionTracker;
import org.neo4j.kernel.api.security.AuthManager;
import org.neo4j.kernel.api.security.UserManagerSupplier;
Expand Down Expand Up @@ -112,6 +114,8 @@ public interface Dependencies
UserManagerSupplier userManagerSupplier();

SslPolicyLoader sslPolicyFactory();

FileSystemAbstraction fileSystem();
}

public BoltKernelExtension()
Expand All @@ -135,6 +139,7 @@ public Lifecycle newInstance( KernelContext context, Dependencies dependencies )
JobScheduler scheduler = dependencies.scheduler();

InternalLoggerFactory.setDefaultFactory( new Netty4LoggerFactory( logService.getInternalLogProvider() ) );
BoltMessageLogging boltLogging = BoltMessageLogging.create( dependencies.fileSystem(), scheduler, config, log );

Authentication authentication = authentication( dependencies.authManager(), dependencies.userManagerSupplier() );

Expand Down Expand Up @@ -181,7 +186,7 @@ public Lifecycle newInstance( KernelContext context, Dependencies dependencies )
final Map<Long, Function<BoltChannel, BoltMessagingProtocolHandler>> protocolHandlers =
getProtocolHandlers( logService, workerFactory );
return new SocketTransport( listenAddress, sslCtx, requireEncryption, logService.getInternalLogProvider(),
BoltMessageLog.getInstance(), protocolHandlers );
boltLogging, protocolHandlers );
} ) );

if ( connectors.size() > 0 && !config.get( GraphDatabaseSettings.disconnected ) )
Expand Down
142 changes: 0 additions & 142 deletions community/bolt/src/main/java/org/neo4j/bolt/BoltMessageLog.java

This file was deleted.

148 changes: 0 additions & 148 deletions community/bolt/src/main/java/org/neo4j/bolt/BoltMessageLogger.java

This file was deleted.

0 comments on commit e09963e

Please sign in to comment.