Search in sources :

Example 66 with Log

use of org.neo4j.logging.Log in project neo4j by neo4j.

the class GlobalModule method createPageCache.

protected PageCache createPageCache(FileSystemAbstraction fileSystem, Config config, LogService logging, Tracers tracers, JobScheduler jobScheduler, SystemNanoClock clock, MemoryPools memoryPools) {
    Log pageCacheLog = logging.getInternalLog(PageCache.class);
    ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory(fileSystem, config, tracers.getPageCacheTracer(), pageCacheLog, jobScheduler, clock, memoryPools);
    PageCache pageCache = pageCacheFactory.getOrCreatePageCache();
    if (config.get(GraphDatabaseInternalSettings.dump_configuration)) {
        pageCacheFactory.dumpConfiguration();
    }
    return pageCache;
}
Also used : Log(org.neo4j.logging.Log) ConfiguringPageCacheFactory(org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory) PageCache(org.neo4j.io.pagecache.PageCache)

Example 67 with Log

use of org.neo4j.logging.Log in project neo4j by neo4j.

the class GlobalModule method createFileSystemWatcherService.

private FileSystemWatcherService createFileSystemWatcherService(FileSystemAbstraction fileSystem, LogService logging, JobScheduler jobScheduler, Config config) {
    if (!config.get(filewatcher_enabled)) {
        Log log = logging.getInternalLog(getClass());
        log.info("File watcher disabled by configuration.");
        return FileSystemWatcherService.EMPTY_WATCHER;
    }
    try {
        return new DefaultFileSystemWatcherService(jobScheduler, fileSystem.fileWatcher());
    } catch (Exception e) {
        Log log = logging.getInternalLog(getClass());
        log.warn("Can not create file watcher for current file system. File monitoring capabilities for store files will be disabled.", e);
        return FileSystemWatcherService.EMPTY_WATCHER;
    }
}
Also used : Log(org.neo4j.logging.Log) DefaultFileSystemWatcherService(org.neo4j.kernel.impl.util.watcher.DefaultFileSystemWatcherService)

Example 68 with Log

use of org.neo4j.logging.Log in project neo4j by neo4j.

the class TransactionRangeDiagnosticsTest method shouldLogCorrectTransactionLogDiagnosticsForNoTransactionLogs.

@Test
void shouldLogCorrectTransactionLogDiagnosticsForNoTransactionLogs() throws IOException {
    // GIVEN
    Database database = databaseWithLogFilesContainingLowestTxId(noLogs());
    AssertableLogProvider logProvider = new AssertableLogProvider();
    Log logger = logProvider.getLog(getClass());
    // WHEN
    new TransactionRangeDiagnostics(database).dump(logger::info);
    // THEN
    assertThat(logProvider).containsMessages("Transaction log files stored on file store:").containsMessages(" - no transactions found").containsMessages(" - no checkpoints found");
}
Also used : Log(org.neo4j.logging.Log) Database(org.neo4j.kernel.database.Database) AssertableLogProvider(org.neo4j.logging.AssertableLogProvider) Test(org.junit.jupiter.api.Test)

Example 69 with Log

use of org.neo4j.logging.Log in project neo4j by neo4j.

the class TransactionRangeDiagnosticsTest method shouldLogCorrectTransactionLogDiagnosticsForTransactionsAndCheckpointLogs.

@Test
void shouldLogCorrectTransactionLogDiagnosticsForTransactionsAndCheckpointLogs() throws Exception {
    // GIVEN
    long txLogLowVersion = 2;
    long txLogHighVersion = 10;
    long checkpointLogLowVersion = 0;
    long checkpointLogHighVersion = 3;
    StoreId storeId = new StoreId(12345);
    LogPosition checkpointLogPosition = new LogPosition(checkpointLogHighVersion, 34);
    Database database = databaseWithLogFilesContainingLowestTxId(logs(transactionLogsWithTransaction(txLogLowVersion, txLogHighVersion, 42), checkpointLogsWithLastCheckpoint(checkpointLogLowVersion, checkpointLogHighVersion, new CheckpointInfo(new LogEntryDetachedCheckpoint(KernelVersion.LATEST, checkpointLogPosition, 1234, storeId, "testing"), checkpointLogPosition))));
    AssertableLogProvider logProvider = new AssertableLogProvider();
    Log logger = logProvider.getLog(getClass());
    // WHEN
    new TransactionRangeDiagnostics(database).dump(logger::info);
    // THEN
    assertThat(logProvider).containsMessages("existing transaction log versions " + txLogLowVersion + "-" + txLogHighVersion).containsMessages("existing checkpoint log versions " + checkpointLogLowVersion + "-" + checkpointLogHighVersion);
}
Also used : LogEntryDetachedCheckpoint(org.neo4j.kernel.impl.transaction.log.entry.LogEntryDetachedCheckpoint) StoreId(org.neo4j.storageengine.api.StoreId) Log(org.neo4j.logging.Log) Database(org.neo4j.kernel.database.Database) CheckpointInfo(org.neo4j.kernel.impl.transaction.log.files.checkpoint.CheckpointInfo) LogPosition(org.neo4j.kernel.impl.transaction.log.LogPosition) AssertableLogProvider(org.neo4j.logging.AssertableLogProvider) Test(org.junit.jupiter.api.Test)

Example 70 with Log

use of org.neo4j.logging.Log in project neo4j by neo4j.

the class PageCachedNumberArrayFactoryTest method shouldLogAllocationOnLongArray.

@Test
void shouldLogAllocationOnLongArray() {
    // given
    Log log = mock(Log.class);
    Path dir = directory.directory("cache");
    PageCachedNumberArrayFactory factory = new PageCachedNumberArrayFactory(pageCache, NULL, dir, log, DEFAULT_DATABASE_NAME);
    // when
    factory.newLongArray(1_000, -1, 0, INSTANCE).close();
    // then
    verify(log).info(ArgumentMatchers.contains("Using page-cache backed caching"));
}
Also used : Path(java.nio.file.Path) Log(org.neo4j.logging.Log) Test(org.junit.jupiter.api.Test)

Aggregations

Log (org.neo4j.logging.Log)164 Test (org.junit.Test)60 NullLog (org.neo4j.logging.NullLog)53 Test (org.junit.jupiter.api.Test)50 AssertableLogProvider (org.neo4j.logging.AssertableLogProvider)24 Path (java.nio.file.Path)20 LogProvider (org.neo4j.logging.LogProvider)15 File (java.io.File)13 IOException (java.io.IOException)12 Map (java.util.Map)12 Config (org.neo4j.kernel.configuration.Config)10 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)10 PageCache (org.neo4j.io.pagecache.PageCache)9 LifeSupport (org.neo4j.kernel.lifecycle.LifeSupport)8 NullLogProvider (org.neo4j.logging.NullLogProvider)7 HashMap (java.util.HashMap)6 Config (org.neo4j.configuration.Config)6 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)6 BasicContext (org.neo4j.kernel.api.proc.BasicContext)6 CallableProcedure (org.neo4j.kernel.api.procedure.CallableProcedure)6