Search in sources :

Example 46 with LogProvider

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

the class CommonAbstractStoreTest method newStore.

private TheStore newStore() {
    LogProvider log = NullLogProvider.getInstance();
    TheStore store = new TheStore(storeFile, config, idType, idGeneratorFactory, pageCache, log, recordFormat);
    store.initialise(false);
    return store;
}
Also used : NullLogProvider(org.neo4j.logging.NullLogProvider) LogProvider(org.neo4j.logging.LogProvider)

Example 47 with LogProvider

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

the class LuceneLabelScanStoreExtension method newInstance.

@Override
public LabelScanStoreProvider newInstance(KernelContext context, Dependencies dependencies) throws Throwable {
    Config config = dependencies.getConfig();
    boolean ephemeral = config.get(GraphDatabaseFacadeFactory.Configuration.ephemeral);
    FileSystemAbstraction fileSystem = dependencies.fileSystem();
    DirectoryFactory directoryFactory = directoryFactory(ephemeral, fileSystem);
    LuceneLabelScanIndexBuilder indexBuilder = getIndexBuilder(context, directoryFactory, fileSystem, config);
    LogProvider logger = dependencies.getLogService().getInternalLogProvider();
    Monitor loggingMonitor = new LoggingMonitor(logger.getLog(LuceneLabelScanStore.class), monitor);
    LuceneLabelScanStore scanStore = new LuceneLabelScanStore(indexBuilder, new FullLabelStream(dependencies.indexStoreView()), loggingMonitor);
    return new LabelScanStoreProvider(NAME, scanStore);
}
Also used : LogProvider(org.neo4j.logging.LogProvider) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) LoggingMonitor(org.neo4j.kernel.api.labelscan.LoggingMonitor) Monitor(org.neo4j.kernel.api.labelscan.LabelScanStore.Monitor) LabelScanStoreProvider(org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider) LoggingMonitor(org.neo4j.kernel.api.labelscan.LoggingMonitor) Config(org.neo4j.kernel.configuration.Config) DirectoryFactory(org.neo4j.kernel.api.impl.index.storage.DirectoryFactory) FullLabelStream(org.neo4j.kernel.impl.api.scan.FullLabelStream)

Example 48 with LogProvider

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

the class ConcurrentChangesOnEntitiesTest method assertDatabaseConsistent.

private void assertDatabaseConsistent() throws IOException {
    LogProvider logProvider = FormattedLogProvider.toOutputStream(System.out);
    try {
        ConsistencyCheckService.Result result = new ConsistencyCheckService().runFullConsistencyCheck(testDirectory.graphDbDir(), Config.defaults(), ProgressMonitorFactory.textual(System.err), logProvider, false);
        assertTrue(result.isSuccessful());
    } catch (ConsistencyCheckIncompleteException e) {
        fail(e.getMessage());
    }
}
Also used : LogProvider(org.neo4j.logging.LogProvider) FormattedLogProvider(org.neo4j.logging.FormattedLogProvider) ConsistencyCheckService(org.neo4j.consistency.ConsistencyCheckService) ConsistencyCheckIncompleteException(org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException)

Example 49 with LogProvider

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

the class ServerBootstrapper method start.

@Override
@SafeVarargs
public final int start(File homeDir, Optional<File> configFile, Pair<String, String>... configOverrides) {
    addShutdownHook();
    try {
        Config config = createConfig(homeDir, configFile, configOverrides);
        LogProvider userLogProvider = setupLogging(config);
        dependencies = dependencies.userLogProvider(userLogProvider);
        log = userLogProvider.getLog(getClass());
        config.setLogger(log);
        serverAddress = config.httpConnectors().stream().filter(c -> Encryption.NONE.equals(c.encryptionLevel())).findFirst().map((connector) -> config.get(connector.listen_address).toString()).orElse(serverAddress);
        checkCompatibility();
        server = createNeoServer(config, dependencies, userLogProvider);
        server.start();
        return OK;
    } catch (ServerStartupException e) {
        e.describeTo(log);
        return WEB_SERVER_STARTUP_ERROR_CODE;
    } catch (TransactionFailureException tfe) {
        String locationMsg = (server == null) ? "" : " Another process may be using database location " + server.getDatabase().getLocation();
        log.error(format("Failed to start Neo4j on %s.", serverAddress) + locationMsg, tfe);
        return GRAPH_DATABASE_STARTUP_ERROR_CODE;
    } catch (Exception e) {
        log.error(format("Failed to start Neo4j on %s.", serverAddress), e);
        return WEB_SERVER_STARTUP_ERROR_CODE;
    }
}
Also used : LogProvider(org.neo4j.logging.LogProvider) FormattedLogProvider(org.neo4j.logging.FormattedLogProvider) TransactionFailureException(org.neo4j.graphdb.TransactionFailureException) Config(org.neo4j.kernel.configuration.Config) TransactionFailureException(org.neo4j.graphdb.TransactionFailureException)

Aggregations

LogProvider (org.neo4j.logging.LogProvider)49 NullLogProvider (org.neo4j.logging.NullLogProvider)19 Test (org.junit.Test)16 Config (org.neo4j.kernel.configuration.Config)16 File (java.io.File)15 FormattedLogProvider (org.neo4j.logging.FormattedLogProvider)12 Log (org.neo4j.logging.Log)12 OnDemandJobScheduler (org.neo4j.test.OnDemandJobScheduler)9 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)8 DummyRaftableContentSerializer (org.neo4j.causalclustering.core.consensus.log.DummyRaftableContentSerializer)6 LogService (org.neo4j.kernel.impl.logging.LogService)6 Monitors (org.neo4j.kernel.monitoring.Monitors)5 DependencyResolver (org.neo4j.graphdb.DependencyResolver)4 StoreFactory (org.neo4j.kernel.impl.store.StoreFactory)4 IOException (java.io.IOException)3 Procedures (org.neo4j.kernel.impl.proc.Procedures)3 RecordFormats (org.neo4j.kernel.impl.store.format.RecordFormats)3 JobScheduler (org.neo4j.kernel.impl.util.JobScheduler)3 URI (java.net.URI)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2