use of org.neo4j.logging.LogProvider in project neo4j by neo4j.
the class EnterpriseBootstrapperTest method debugLoggingEnabledBySetting.
@Test
public void debugLoggingEnabledBySetting() throws Exception {
// When
File configFile = tempDir.newFile(ConfigLoader.DEFAULT_CONFIG_FILE_NAME);
Map<String, String> properties = stringMap(store_internal_log_level.name(), "DEBUG");
properties.putAll(ServerTestUtils.getDefaultRelativeProperties());
properties.put("dbms.connector.1.type", "HTTP");
properties.put("dbms.connector.1.encryption", "NONE");
properties.put("dbms.connector.1.enabled", "true");
store(properties, configFile);
// When
UncoveredEnterpriseBootstrapper uncoveredEnterpriseBootstrapper = new UncoveredEnterpriseBootstrapper();
cleanupRule.add(uncoveredEnterpriseBootstrapper);
ServerBootstrapper.start(uncoveredEnterpriseBootstrapper, "--home-dir", tempDir.newFolder("home-dir").getAbsolutePath(), "--config-dir", configFile.getParentFile().getAbsolutePath());
// Then
assertEventually("Server was started", uncoveredEnterpriseBootstrapper::isRunning, is(true), 1, TimeUnit.MINUTES);
LogProvider userLogProvider = uncoveredEnterpriseBootstrapper.getUserLogProvider();
assertTrue("Debug logging enabled by setting value.", userLogProvider.getLog(getClass()).isDebugEnabled());
}
use of org.neo4j.logging.LogProvider in project neo4j by neo4j.
the class BackupServiceIT method shouldPrintThatIncrementalBackupIsPerformedAndFallingBackToFull.
@Test
public void shouldPrintThatIncrementalBackupIsPerformedAndFallingBackToFull() throws Exception {
defaultBackupPortHostParams();
Config defaultConfig = dbRule.getConfigCopy();
dbRule.setConfig(GraphDatabaseSettings.keep_logical_logs, "false");
// have logs rotated on every transaction
GraphDatabaseAPI db = dbRule.getGraphDatabaseAPI();
createAndIndexNode(db, 1);
// A full backup
backupService().doFullBackup(BACKUP_HOST, backupPort, backupDir, ConsistencyCheck.NONE, defaultConfig, BackupClient.BIG_READ_TIMEOUT, false);
// And the log the backup uses is rotated out
createAndIndexNode(db, 2);
rotateAndCheckPoint(db);
createAndIndexNode(db, 3);
rotateAndCheckPoint(db);
createAndIndexNode(db, 4);
rotateAndCheckPoint(db);
final Log log = mock(Log.class);
LogProvider logProvider = new LogProvider() {
@Override
public Log getLog(Class loggingClass) {
return log;
}
@Override
public Log getLog(String name) {
return log;
}
};
backupService(logProvider).doIncrementalBackupOrFallbackToFull(BACKUP_HOST, backupPort, backupDir, ConsistencyCheck.NONE, dbRule.getConfigCopy(), BackupClient.BIG_READ_TIMEOUT, false);
verify(log).info("Previous backup found, trying incremental backup.");
verify(log).info("Existing backup is too far out of date, a new full backup will be performed.");
}
use of org.neo4j.logging.LogProvider in project neo4j by neo4j.
the class ServerBootstrapperTest method shouldNotThrowNullPointerExceptionIfConfigurationValidationFails.
@Test
public void shouldNotThrowNullPointerExceptionIfConfigurationValidationFails() throws Exception {
// given
ServerBootstrapper serverBootstrapper = new ServerBootstrapper() {
@Override
protected NeoServer createNeoServer(Config config, GraphDatabaseDependencies dependencies, LogProvider userLogProvider) {
return mock(NeoServer.class);
}
@Nonnull
@Override
protected Collection<ConfigurationValidator> configurationValidators() {
return Collections.emptyList();
}
};
File dir = Files.createTempDirectory("test-server-bootstrapper").toFile();
dir.deleteOnExit();
// when
serverBootstrapper.start(dir, Optional.empty());
// then no exceptions are thrown and
assertThat(suppress.getOutputVoice().lines(), not(empty()));
}
use of org.neo4j.logging.LogProvider in project neo4j by neo4j.
the class SegmentedRaftLogVerificationIT method createRaftLog.
@Override
protected RaftLog createRaftLog() throws Throwable {
FileSystemAbstraction fsa = fsRule.get();
File directory = new File(RAFT_LOG_DIRECTORY_NAME);
fsa.mkdir(directory);
long rotateAtSizeBytes = 128;
int readerPoolSize = 8;
LogProvider logProvider = getInstance();
CoreLogPruningStrategy pruningStrategy = new CoreLogPruningStrategyFactory(raft_log_pruning_strategy.getDefaultValue(), logProvider).newInstance();
SegmentedRaftLog newRaftLog = new SegmentedRaftLog(fsa, directory, rotateAtSizeBytes, new DummyRaftableContentSerializer(), logProvider, readerPoolSize, Clocks.systemClock(), new OnDemandJobScheduler(), pruningStrategy);
newRaftLog.init();
newRaftLog.start();
return newRaftLog;
}
use of org.neo4j.logging.LogProvider in project neo4j by neo4j.
the class SegmentedRaftLogContractTest method createRaftLog.
@Override
public RaftLog createRaftLog() {
File directory = new File(RAFT_LOG_DIRECTORY_NAME);
FileSystemAbstraction fileSystem = fsRule.get();
fileSystem.mkdir(directory);
LogProvider logProvider = getInstance();
CoreLogPruningStrategy pruningStrategy = new CoreLogPruningStrategyFactory("1 entries", logProvider).newInstance();
return life.add(new SegmentedRaftLog(fileSystem, directory, 1024, new DummyRaftableContentSerializer(), logProvider, 8, Clocks.fakeClock(), new OnDemandJobScheduler(), pruningStrategy));
}
Aggregations