Skip to content

Commit

Permalink
Add config setting for debug log path
Browse files Browse the repository at this point in the history
  • Loading branch information
spacecowboy committed May 29, 2017
1 parent 6d75f74 commit f246708
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 41 deletions.
Expand Up @@ -75,6 +75,7 @@
import org.neo4j.unsafe.impl.batchimport.staging.ExecutionMonitors; import org.neo4j.unsafe.impl.batchimport.staging.ExecutionMonitors;


import static java.nio.charset.Charset.defaultCharset; import static java.nio.charset.Charset.defaultCharset;
import static org.neo4j.graphdb.factory.GraphDatabaseSettings.store_internal_log_path;
import static org.neo4j.helpers.Exceptions.launderedException; import static org.neo4j.helpers.Exceptions.launderedException;
import static org.neo4j.helpers.Format.bytes; import static org.neo4j.helpers.Format.bytes;
import static org.neo4j.helpers.Strings.TAB; import static org.neo4j.helpers.Strings.TAB;
Expand Down Expand Up @@ -501,7 +502,8 @@ public static void doImport( PrintStream out, PrintStream err, File storeDir, Fi
boolean success; boolean success;
LifeSupport life = new LifeSupport(); LifeSupport life = new LifeSupport();


LogService logService = life.add( StoreLogService.inLogsDirectory( fs, logsDir ) ); File internalLogFile = dbConfig.get( store_internal_log_path );
LogService logService = life.add( StoreLogService.withInternalLog( internalLogFile ).build( fs ) );


life.start(); life.start();
//TODO: add file watcher here? //TODO: add file watcher here?
Expand Down
Expand Up @@ -502,6 +502,12 @@ public class GraphDatabaseSettings implements LoadableConfig
( logs ) -> new File( logs, "query.log" ), ( logs ) -> new File( logs, "query.log" ),
PATH ); PATH );


@Description( "Path to the debug log file." )
public static final Setting<File> store_internal_log_path = derivedSetting( "dbms.logs.debug.path",
logs_directory,
( logs ) -> new File( logs, "debug.log" ),
PATH );

@Description( "Log parameters for the executed queries being logged." ) @Description( "Log parameters for the executed queries being logged." )
public static final Setting<Boolean> log_queries_parameter_logging_enabled = public static final Setting<Boolean> log_queries_parameter_logging_enabled =
setting( "dbms.logs.query.parameter_logging_enabled", BOOLEAN, TRUE ); setting( "dbms.logs.query.parameter_logging_enabled", BOOLEAN, TRUE );
Expand Down
Expand Up @@ -66,6 +66,7 @@
import org.neo4j.udc.UsageData; import org.neo4j.udc.UsageData;
import org.neo4j.udc.UsageDataKeys; import org.neo4j.udc.UsageDataKeys;


import static org.neo4j.graphdb.factory.GraphDatabaseSettings.store_internal_log_path;
import static org.neo4j.helpers.collection.MapUtil.stringMap; import static org.neo4j.helpers.collection.MapUtil.stringMap;


/** /**
Expand Down Expand Up @@ -273,11 +274,15 @@ protected LogService createLogService( LogProvider userLogProvider )
} }
builder.withDefaultLevel( config.get( GraphDatabaseSettings.store_internal_log_level ) ); builder.withDefaultLevel( config.get( GraphDatabaseSettings.store_internal_log_level ) );


File logsDir = config.get( GraphDatabaseSettings.logs_directory ); File logFile = config.get( store_internal_log_path );
if ( !logFile.getParentFile().exists() )
{
logFile.getParentFile().mkdirs();
}
StoreLogService logService; StoreLogService logService;
try try
{ {
logService = builder.inLogsDirectory( fileSystem, logsDir ); logService = builder.withInternalLog( logFile ).build( fileSystem );
} }
catch ( IOException ex ) catch ( IOException ex )
{ {
Expand Down
Expand Up @@ -41,7 +41,7 @@


public class StoreLogService extends AbstractLogService implements Lifecycle public class StoreLogService extends AbstractLogService implements Lifecycle
{ {
public static final String INTERNAL_LOG_NAME = "debug.log"; //public static final String INTERNAL_LOG_NAME = "debug.log";


public static class Builder public static class Builder
{ {
Expand All @@ -55,6 +55,7 @@ public static class Builder
}; };
private Map<String, Level> logLevels = new HashMap<>(); private Map<String, Level> logLevels = new HashMap<>();
private Level defaultLevel = Level.INFO; private Level defaultLevel = Level.INFO;
private File debugLog;


private Builder() private Builder()
{ {
Expand Down Expand Up @@ -101,12 +102,21 @@ public Builder withDefaultLevel( Level defaultLevel )
return this; return this;
} }


public StoreLogService inLogsDirectory( FileSystemAbstraction fileSystem, File logsDir ) throws IOException public Builder withInternalLog( File logFile ) throws IOException
{ {
return new StoreLogService( this.debugLog = logFile;
userLogProvider, return this;
fileSystem, new File( logsDir, INTERNAL_LOG_NAME ), logLevels, defaultLevel, }
internalLogRotationThreshold, internalLogRotationDelay, maxInternalLogArchives, rotationExecutor, rotationListener );
public StoreLogService build( FileSystemAbstraction fileSystem ) throws IOException
{
if ( debugLog == null )
{
throw new IllegalArgumentException( "Debug log can't be null; set its value using `withInternalLog`" );
}
return new StoreLogService( userLogProvider, fileSystem, debugLog, logLevels, defaultLevel,
internalLogRotationThreshold, internalLogRotationDelay, maxInternalLogArchives, rotationExecutor,
rotationListener );
} }
} }


Expand All @@ -122,9 +132,9 @@ public static Builder withRotation( long internalLogRotationThreshold, long inte
jobScheduler ); jobScheduler );
} }


public static StoreLogService inLogsDirectory( FileSystemAbstraction fileSystem, File storeDir ) throws IOException public static Builder withInternalLog( File logFile ) throws IOException
{ {
return new Builder().inLogsDirectory( fileSystem, storeDir ); return new Builder().withInternalLog( logFile );
} }


private final Closeable closeable; private final Closeable closeable;
Expand Down
Expand Up @@ -168,6 +168,7 @@
import static java.util.Collections.emptyIterator; import static java.util.Collections.emptyIterator;
import static org.neo4j.collection.primitive.PrimitiveLongCollections.map; import static org.neo4j.collection.primitive.PrimitiveLongCollections.map;
import static org.neo4j.graphdb.Label.label; import static org.neo4j.graphdb.Label.label;
import static org.neo4j.graphdb.factory.GraphDatabaseSettings.store_internal_log_path;
import static org.neo4j.kernel.impl.store.NodeLabelsField.parseLabelsField; import static org.neo4j.kernel.impl.store.NodeLabelsField.parseLabelsField;
import static org.neo4j.kernel.impl.store.PropertyStore.encodeString; import static org.neo4j.kernel.impl.store.PropertyStore.encodeString;
import static org.neo4j.kernel.impl.util.IoPrimitiveUtils.safeCastLongToInt; import static org.neo4j.kernel.impl.util.IoPrimitiveUtils.safeCastLongToInt;
Expand Down Expand Up @@ -238,7 +239,8 @@ public BatchInserterImpl( final File storeDir, final FileSystemAbstraction fileS
PageCache pageCache = pageCacheFactory.getOrCreatePageCache(); PageCache pageCache = pageCacheFactory.getOrCreatePageCache();
life.add( new PageCacheLifecycle( pageCache ) ); life.add( new PageCacheLifecycle( pageCache ) );


StoreLogService logService = life.add( StoreLogService.inLogsDirectory( fileSystem, this.storeDir ) ); File internalLog = config.get( store_internal_log_path );
StoreLogService logService = life.add( StoreLogService.withInternalLog( internalLog).build( fileSystem ) );
msgLog = logService.getInternalLog( getClass() ); msgLog = logService.getInternalLog( getClass() );
storeLocker = tryLockStore( fileSystem ); storeLocker = tryLockStore( fileSystem );


Expand Down
Expand Up @@ -30,7 +30,6 @@


import org.neo4j.graphdb.factory.GraphDatabaseSettings; import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.kernel.impl.logging.LogService; import org.neo4j.kernel.impl.logging.LogService;
import org.neo4j.kernel.impl.logging.StoreLogService;
import org.neo4j.kernel.internal.GraphDatabaseAPI; import org.neo4j.kernel.internal.GraphDatabaseAPI;
import org.neo4j.test.TestGraphDatabaseFactory; import org.neo4j.test.TestGraphDatabaseFactory;
import org.neo4j.test.rule.TestDirectory; import org.neo4j.test.rule.TestDirectory;
Expand All @@ -42,6 +41,7 @@


public class GraphDatabaseInternalLogIT public class GraphDatabaseInternalLogIT
{ {
public static final String INTERNAL_LOG_FILE = "debug.log";
@Rule @Rule
public TestDirectory testDir = TestDirectory.testDirectory(); public TestDirectory testDir = TestDirectory.testDirectory();


Expand All @@ -52,7 +52,7 @@ public void shouldWriteToInternalDiagnosticsLog() throws Exception
new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder( testDir.graphDbDir() ) new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder( testDir.graphDbDir() )
.setConfig( GraphDatabaseSettings.logs_directory, testDir.directory("logs").getAbsolutePath() ) .setConfig( GraphDatabaseSettings.logs_directory, testDir.directory("logs").getAbsolutePath() )
.newGraphDatabase().shutdown(); .newGraphDatabase().shutdown();
File internalLog = new File( testDir.directory( "logs" ), StoreLogService.INTERNAL_LOG_NAME ); File internalLog = new File( testDir.directory( "logs" ), INTERNAL_LOG_FILE );


// Then // Then
assertThat( internalLog.isFile(), is( true ) ); assertThat( internalLog.isFile(), is( true ) );
Expand All @@ -75,7 +75,7 @@ public void shouldNotWriteDebugToInternalDiagnosticsLogByDefault() throws Except
logService.getInternalLog( getClass() ).debug( "A debug entry" ); logService.getInternalLog( getClass() ).debug( "A debug entry" );


db.shutdown(); db.shutdown();
File internalLog = new File( testDir.directory( "logs" ), StoreLogService.INTERNAL_LOG_NAME ); File internalLog = new File( testDir.directory( "logs" ), INTERNAL_LOG_FILE );


// Then // Then
assertThat( internalLog.isFile(), is( true ) ); assertThat( internalLog.isFile(), is( true ) );
Expand All @@ -100,7 +100,7 @@ public void shouldWriteDebugToInternalDiagnosticsLogForEnabledContexts() throws
logService.getInternalLog( StringWriter.class ).debug( "A SW debug entry" ); logService.getInternalLog( StringWriter.class ).debug( "A SW debug entry" );


db.shutdown(); db.shutdown();
File internalLog = new File( testDir.directory( "logs" ), StoreLogService.INTERNAL_LOG_NAME ); File internalLog = new File( testDir.directory( "logs" ), INTERNAL_LOG_FILE );


// Then // Then
assertThat( internalLog.isFile(), is( true ) ); assertThat( internalLog.isFile(), is( true ) );
Expand Down
Expand Up @@ -76,7 +76,6 @@
import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig; import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig;
import org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider; import org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider;
import org.neo4j.kernel.impl.api.scan.NativeLabelScanStoreExtension; import org.neo4j.kernel.impl.api.scan.NativeLabelScanStoreExtension;
import org.neo4j.kernel.impl.logging.StoreLogService;
import org.neo4j.kernel.impl.spi.KernelContext; import org.neo4j.kernel.impl.spi.KernelContext;
import org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine; import org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine;
import org.neo4j.kernel.impl.store.NeoStores; import org.neo4j.kernel.impl.store.NeoStores;
Expand Down Expand Up @@ -639,7 +638,7 @@ public void messagesLogGetsClosed() throws Exception
File storeDir = this.storeDir.graphDbDir(); File storeDir = this.storeDir.graphDbDir();
BatchInserter inserter = BatchInserters.inserter( storeDir, fileSystemRule.get(), stringMap() ); BatchInserter inserter = BatchInserters.inserter( storeDir, fileSystemRule.get(), stringMap() );
inserter.shutdown(); inserter.shutdown();
assertTrue( new File( storeDir, StoreLogService.INTERNAL_LOG_NAME ).delete() ); assertTrue( new File( storeDir, "debug.log" ).delete() );
} }


@Test @Test
Expand Down
8 changes: 4 additions & 4 deletions community/neo4j/src/test/java/upgrade/StoreUpgraderTest.java
Expand Up @@ -45,7 +45,6 @@
import org.neo4j.kernel.impl.api.index.inmemory.InMemoryIndexProvider; import org.neo4j.kernel.impl.api.index.inmemory.InMemoryIndexProvider;
import org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider; import org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider;
import org.neo4j.kernel.impl.logging.NullLogService; import org.neo4j.kernel.impl.logging.NullLogService;
import org.neo4j.kernel.impl.logging.StoreLogService;
import org.neo4j.kernel.impl.store.MetaDataStore; import org.neo4j.kernel.impl.store.MetaDataStore;
import org.neo4j.kernel.impl.store.NeoStores; import org.neo4j.kernel.impl.store.NeoStores;
import org.neo4j.kernel.impl.store.StoreFactory; import org.neo4j.kernel.impl.store.StoreFactory;
Expand Down Expand Up @@ -89,6 +88,7 @@
import static org.mockito.Matchers.any; import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq; import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.neo4j.graphdb.GraphDatabaseInternalLogIT.INTERNAL_LOG_FILE;
import static org.neo4j.kernel.impl.storemigration.MigrationTestUtils.prepareSampleLegacyDatabase; import static org.neo4j.kernel.impl.storemigration.MigrationTestUtils.prepareSampleLegacyDatabase;
import static org.neo4j.kernel.impl.storemigration.MigrationTestUtils.removeCheckPointFromTxLog; import static org.neo4j.kernel.impl.storemigration.MigrationTestUtils.removeCheckPointFromTxLog;
import static org.neo4j.kernel.impl.storemigration.MigrationTestUtils.verifyFilesHaveSameContent; import static org.neo4j.kernel.impl.storemigration.MigrationTestUtils.verifyFilesHaveSameContent;
Expand Down Expand Up @@ -318,7 +318,7 @@ public void shouldContinueMovingFilesIfUpgradeCancelledWhileMoving() throws Exce
public void upgradedNeoStoreShouldHaveNewUpgradeTimeAndUpgradeId() throws Exception public void upgradedNeoStoreShouldHaveNewUpgradeTimeAndUpgradeId() throws Exception
{ {
// Given // Given
fileSystem.deleteFile( new File( dbDirectory, StoreLogService.INTERNAL_LOG_NAME ) ); fileSystem.deleteFile( new File( dbDirectory, INTERNAL_LOG_FILE ) );
PageCache pageCache = pageCacheRule.getPageCache( fileSystem ); PageCache pageCache = pageCacheRule.getPageCache( fileSystem );
UpgradableDatabase upgradableDatabase = new UpgradableDatabase( fileSystem, UpgradableDatabase upgradableDatabase = new UpgradableDatabase( fileSystem,
new StoreVersionCheck( pageCache ), new StoreVersionCheck( pageCache ),
Expand All @@ -345,7 +345,7 @@ public void upgradedNeoStoreShouldHaveNewUpgradeTimeAndUpgradeId() throws Except
public void upgradeShouldNotLeaveLeftoverAndMigrationDirs() throws Exception public void upgradeShouldNotLeaveLeftoverAndMigrationDirs() throws Exception
{ {
// Given // Given
fileSystem.deleteFile( new File( dbDirectory, StoreLogService.INTERNAL_LOG_NAME ) ); fileSystem.deleteFile( new File( dbDirectory, INTERNAL_LOG_FILE ) );
PageCache pageCache = pageCacheRule.getPageCache( fileSystem ); PageCache pageCache = pageCacheRule.getPageCache( fileSystem );
UpgradableDatabase upgradableDatabase = new UpgradableDatabase( fileSystem, UpgradableDatabase upgradableDatabase = new UpgradableDatabase( fileSystem,
new StoreVersionCheck( pageCache ), new StoreVersionCheck( pageCache ),
Expand All @@ -362,7 +362,7 @@ public void upgradeShouldNotLeaveLeftoverAndMigrationDirs() throws Exception
public void upgraderShouldCleanupLegacyLeftoverAndMigrationDirs() throws Exception public void upgraderShouldCleanupLegacyLeftoverAndMigrationDirs() throws Exception
{ {
// Given // Given
fileSystem.deleteFile( new File( dbDirectory, StoreLogService.INTERNAL_LOG_NAME ) ); fileSystem.deleteFile( new File( dbDirectory, INTERNAL_LOG_FILE ) );
fileSystem.mkdir( new File( dbDirectory, StoreUpgrader.MIGRATION_DIRECTORY ) ); fileSystem.mkdir( new File( dbDirectory, StoreUpgrader.MIGRATION_DIRECTORY ) );
fileSystem.mkdir( new File( dbDirectory, StoreUpgrader.MIGRATION_LEFT_OVERS_DIRECTORY ) ); fileSystem.mkdir( new File( dbDirectory, StoreUpgrader.MIGRATION_LEFT_OVERS_DIRECTORY ) );
fileSystem.mkdir( new File( dbDirectory, StoreUpgrader.MIGRATION_LEFT_OVERS_DIRECTORY + "_1" ) ); fileSystem.mkdir( new File( dbDirectory, StoreUpgrader.MIGRATION_LEFT_OVERS_DIRECTORY + "_1" ) );
Expand Down
Expand Up @@ -57,7 +57,6 @@
import org.neo4j.kernel.configuration.Settings; import org.neo4j.kernel.configuration.Settings;
import org.neo4j.kernel.extension.KernelExtensionFactory; import org.neo4j.kernel.extension.KernelExtensionFactory;
import org.neo4j.kernel.impl.logging.LogService; import org.neo4j.kernel.impl.logging.LogService;
import org.neo4j.kernel.impl.logging.StoreLogService;
import org.neo4j.kernel.impl.store.MetaDataStore; import org.neo4j.kernel.impl.store.MetaDataStore;
import org.neo4j.kernel.impl.store.MismatchingStoreIdException; import org.neo4j.kernel.impl.store.MismatchingStoreIdException;
import org.neo4j.kernel.impl.store.StoreId; import org.neo4j.kernel.impl.store.StoreId;
Expand All @@ -78,6 +77,7 @@


import static org.neo4j.com.RequestContext.anonymous; import static org.neo4j.com.RequestContext.anonymous;
import static org.neo4j.com.storecopy.TransactionCommittingResponseUnpacker.DEFAULT_BATCH_SIZE; import static org.neo4j.com.storecopy.TransactionCommittingResponseUnpacker.DEFAULT_BATCH_SIZE;
import static org.neo4j.graphdb.factory.GraphDatabaseSettings.store_internal_log_path;
import static org.neo4j.helpers.Exceptions.rootCause; import static org.neo4j.helpers.Exceptions.rootCause;
import static org.neo4j.kernel.impl.pagecache.ConfigurableStandalonePageCacheFactory.createPageCache; import static org.neo4j.kernel.impl.pagecache.ConfigurableStandalonePageCacheFactory.createPageCache;


Expand Down Expand Up @@ -177,7 +177,8 @@ private BackupOutcome fullBackup( FileSystemAbstraction fileSystem, String sourc
CancellationRequest.NEVER_CANCELLED, CancellationRequest.NEVER_CANCELLED,
MoveAfterCopy.moveReplaceExisting() ); MoveAfterCopy.moveReplaceExisting() );


bumpDebugDotLogFileVersion( targetDirectory, timestamp ); File debugLogFile = tuningConfiguration.get( store_internal_log_path );
bumpDebugDotLogFileVersion( debugLogFile, timestamp );
boolean consistent = checkDbConsistency( fileSystem, targetDirectory, consistencyCheck, tuningConfiguration, pageCache ); boolean consistent = checkDbConsistency( fileSystem, targetDirectory, consistencyCheck, tuningConfiguration, pageCache );
clearIdFiles( fileSystem, targetDirectory ); clearIdFiles( fileSystem, targetDirectory );
return new BackupOutcome( lastCommittedTx, consistent ); return new BackupOutcome( lastCommittedTx, consistent );
Expand Down Expand Up @@ -234,7 +235,8 @@ private BackupOutcome incrementalBackup( FileSystemAbstraction fileSystem, Strin
{ {
targetDb.shutdown(); targetDb.shutdown();
} }
bumpDebugDotLogFileVersion( targetDirectory, backupStartTime ); File debugLogFile = config.get( store_internal_log_path );
bumpDebugDotLogFileVersion( debugLogFile, backupStartTime );
boolean consistent = checkDbConsistency( fileSystem, targetDirectory, consistencyCheck, config, pageCache ); boolean consistent = checkDbConsistency( fileSystem, targetDirectory, consistencyCheck, config, pageCache );
clearIdFiles( fileSystem, targetDirectory ); clearIdFiles( fileSystem, targetDirectory );
return new BackupOutcome( lastCommittedTx, consistent ); return new BackupOutcome( lastCommittedTx, consistent );
Expand Down Expand Up @@ -410,18 +412,15 @@ private long incrementalWithContext( String sourceHostNameOrIp, int sourcePort,
return handler.getLastSeenTransactionId(); return handler.getLastSeenTransactionId();
} }


private static boolean bumpDebugDotLogFileVersion( File dbDirectory, long toTimestamp ) private static boolean bumpDebugDotLogFileVersion( final File debugLogFile, final long toTimestamp )
{ {
File[] candidates = dbDirectory.listFiles( ( dir, name ) -> name.equals( StoreLogService.INTERNAL_LOG_NAME ) ); if ( !debugLogFile.exists() )
if ( candidates == null || candidates.length != 1 )
{ {
return false; return false;
} }
// candidates has a unique member, the right one
File previous = candidates[0];
// Build to, from existing parent + new filename // Build to, from existing parent + new filename
File to = new File( previous.getParentFile(), StoreLogService.INTERNAL_LOG_NAME + "." + toTimestamp ); File to = new File( debugLogFile.getParentFile(), debugLogFile.getName() + "." + toTimestamp );
return previous.renameTo( to ); return debugLogFile.renameTo( to );
} }


private List<KernelExtensionFactory<?>> loadKernelExtensions() private List<KernelExtensionFactory<?>> loadKernelExtensions()
Expand Down
Expand Up @@ -55,7 +55,6 @@
import org.neo4j.kernel.impl.factory.EditionModule; import org.neo4j.kernel.impl.factory.EditionModule;
import org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory; import org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory;
import org.neo4j.kernel.impl.factory.PlatformModule; import org.neo4j.kernel.impl.factory.PlatformModule;
import org.neo4j.kernel.impl.logging.StoreLogService;
import org.neo4j.kernel.impl.store.MetaDataStore; import org.neo4j.kernel.impl.store.MetaDataStore;
import org.neo4j.kernel.impl.store.MetaDataStore.Position; import org.neo4j.kernel.impl.store.MetaDataStore.Position;
import org.neo4j.kernel.impl.store.MismatchingStoreIdException; import org.neo4j.kernel.impl.store.MismatchingStoreIdException;
Expand All @@ -81,6 +80,9 @@
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.neo4j.graphdb.factory.GraphDatabaseSettings.dense_node_threshold; import static org.neo4j.graphdb.factory.GraphDatabaseSettings.dense_node_threshold;
import static org.neo4j.graphdb.factory.GraphDatabaseSettings.logs_directory;
import static org.neo4j.graphdb.factory.GraphDatabaseSettings.store_internal_log_path;
import static org.neo4j.helpers.collection.MapUtil.stringMap;
import static org.neo4j.kernel.impl.MyRelTypes.TEST; import static org.neo4j.kernel.impl.MyRelTypes.TEST;


@RunWith( Parameterized.class ) @RunWith( Parameterized.class )
Expand Down Expand Up @@ -576,7 +578,8 @@ protected void startup( File path ) throws Throwable


private static boolean checkLogFileExistence( String directory ) private static boolean checkLogFileExistence( String directory )
{ {
return new File( directory, StoreLogService.INTERNAL_LOG_NAME ).exists(); return Config.embeddedDefaults( stringMap( logs_directory.name(), directory ) ).get( store_internal_log_path )
.exists();
} }


private long lastTxChecksumOf( File storeDir, PageCache pageCache ) throws IOException private long lastTxChecksumOf( File storeDir, PageCache pageCache ) throws IOException
Expand Down
Expand Up @@ -49,7 +49,6 @@
import org.neo4j.kernel.impl.ha.ClusterManager; import org.neo4j.kernel.impl.ha.ClusterManager;
import org.neo4j.kernel.impl.ha.ClusterManager.ManagedCluster; import org.neo4j.kernel.impl.ha.ClusterManager.ManagedCluster;
import org.neo4j.kernel.impl.ha.ClusterManager.RepairKit; import org.neo4j.kernel.impl.ha.ClusterManager.RepairKit;
import org.neo4j.kernel.impl.logging.StoreLogService;
import org.neo4j.kernel.impl.util.Listener; import org.neo4j.kernel.impl.util.Listener;
import org.neo4j.kernel.lifecycle.LifeRule; import org.neo4j.kernel.lifecycle.LifeRule;
import org.neo4j.kernel.monitoring.Monitors; import org.neo4j.kernel.monitoring.Monitors;
Expand Down Expand Up @@ -338,7 +337,7 @@ private long moveAwayToLookLikeOldBranchedDirectory() throws IOException
for ( File file : Objects.requireNonNull( dir.listFiles() ) ) for ( File file : Objects.requireNonNull( dir.listFiles() ) )
{ {
String fileName = file.getName(); String fileName = file.getName();
if ( !fileName.equals( StoreLogService.INTERNAL_LOG_NAME ) && !file.getName().startsWith( "branched-" ) ) if ( !fileName.equals( "debug.log" ) && !file.getName().startsWith( "branched-" ) )
{ {
FileUtils.renameFile( file, new File( branchDir, file.getName() ) ); FileUtils.renameFile( file, new File( branchDir, file.getName() ) );
} }
Expand Down
Expand Up @@ -33,7 +33,6 @@
import org.neo4j.cluster.client.ClusterClientModule; import org.neo4j.cluster.client.ClusterClientModule;
import org.neo4j.cluster.protocol.election.NotElectableElectionCredentialsProvider; import org.neo4j.cluster.protocol.election.NotElectableElectionCredentialsProvider;
import org.neo4j.function.Predicates; import org.neo4j.function.Predicates;
import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.helpers.collection.MapUtil; import org.neo4j.helpers.collection.MapUtil;
import org.neo4j.helpers.collection.Pair; import org.neo4j.helpers.collection.Pair;
import org.neo4j.io.fs.DefaultFileSystemAbstraction; import org.neo4j.io.fs.DefaultFileSystemAbstraction;
Expand All @@ -50,6 +49,7 @@
import org.neo4j.logging.FormattedLogProvider; import org.neo4j.logging.FormattedLogProvider;
import org.neo4j.server.Bootstrapper; import org.neo4j.server.Bootstrapper;


import static org.neo4j.graphdb.factory.GraphDatabaseSettings.store_internal_log_path;
import static org.neo4j.helpers.Exceptions.peel; import static org.neo4j.helpers.Exceptions.peel;


public class ArbiterBootstrapper implements Bootstrapper, AutoCloseable public class ArbiterBootstrapper implements Bootstrapper, AutoCloseable
Expand Down Expand Up @@ -148,11 +148,12 @@ private static void verifyConfig( Map<String, String> config )


private static LogService logService( FileSystemAbstraction fileSystem, Config config ) private static LogService logService( FileSystemAbstraction fileSystem, Config config )
{ {
File logDir = config.get( GraphDatabaseSettings.logs_directory ); File logFile = config.get( store_internal_log_path );
try try
{ {
return StoreLogService.withUserLogProvider( FormattedLogProvider.toOutputStream( System.out ) ) return StoreLogService.withUserLogProvider( FormattedLogProvider.toOutputStream( System.out ) )
.inLogsDirectory( fileSystem, logDir ); .withInternalLog( logFile )
.build( fileSystem );
} }
catch ( IOException e ) catch ( IOException e )
{ {
Expand Down
Expand Up @@ -58,6 +58,7 @@
import org.neo4j.logging.LogProvider; import org.neo4j.logging.LogProvider;


import static java.lang.String.format; import static java.lang.String.format;
import static org.neo4j.graphdb.factory.GraphDatabaseSettings.store_internal_log_path;
import static org.neo4j.kernel.extension.UnsatisfiedDependencyStrategies.ignore; import static org.neo4j.kernel.extension.UnsatisfiedDependencyStrategies.ignore;
import static org.neo4j.kernel.impl.pagecache.ConfigurableStandalonePageCacheFactory.createPageCache; import static org.neo4j.kernel.impl.pagecache.ConfigurableStandalonePageCacheFactory.createPageCache;


Expand Down Expand Up @@ -95,8 +96,8 @@ private static Config getMigrationConfig()
public void run( final FileSystemAbstraction fs, final File storeDirectory, Config config, public void run( final FileSystemAbstraction fs, final File storeDirectory, Config config,
LogProvider userLogProvider ) throws IOException LogProvider userLogProvider ) throws IOException
{ {
StoreLogService logService = StoreLogService logService = StoreLogService.withUserLogProvider( userLogProvider )
StoreLogService.withUserLogProvider( userLogProvider ).inLogsDirectory( fs, storeDirectory ); .withInternalLog( config.get( store_internal_log_path ) ).build( fs );


VisibleMigrationProgressMonitor progressMonitor = VisibleMigrationProgressMonitor progressMonitor =
new VisibleMigrationProgressMonitor( logService.getUserLog( StoreMigration.class ) ); new VisibleMigrationProgressMonitor( logService.getUserLog( StoreMigration.class ) );
Expand Down

0 comments on commit f246708

Please sign in to comment.