Search in sources :

Example 1 with FormattedLogProvider

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

the class StoreMigration method main.

public static void main(String[] args) throws IOException {
    Args arguments = Args.withFlags(HELP_FLAG).parse(args);
    if (arguments.getBoolean(HELP_FLAG, false) || args.length == 0) {
        printUsageAndExit();
    }
    File storeDir = parseDir(arguments);
    FormattedLogProvider userLogProvider = FormattedLogProvider.toOutputStream(System.out);
    try (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction()) {
        new StoreMigration().run(fileSystem, storeDir, getMigrationConfig(), userLogProvider);
    }
}
Also used : Args(org.neo4j.helpers.Args) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) File(java.io.File) FormattedLogProvider(org.neo4j.logging.FormattedLogProvider)

Example 2 with FormattedLogProvider

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

the class ClusterTopologyChangesIT method newClusterClient.

private ClusterClientModule newClusterClient(LifeSupport life, InstanceId id) {
    Config config = Config.embeddedDefaults(MapUtil.stringMap(ClusterSettings.initial_hosts.name(), cluster.getInitialHostsConfigString(), ClusterSettings.server_id.name(), String.valueOf(id.toIntegerIndex()), ClusterSettings.cluster_server.name(), "0.0.0.0:8888"));
    FormattedLogProvider logProvider = FormattedLogProvider.toOutputStream(System.out);
    SimpleLogService logService = new SimpleLogService(logProvider, logProvider);
    return new ClusterClientModule(life, new Dependencies(), new Monitors(), config, logService, new NotElectableElectionCredentialsProvider());
}
Also used : SimpleLogService(org.neo4j.kernel.impl.logging.SimpleLogService) Config(org.neo4j.kernel.configuration.Config) NotElectableElectionCredentialsProvider(org.neo4j.cluster.protocol.election.NotElectableElectionCredentialsProvider) Monitors(org.neo4j.kernel.monitoring.Monitors) Dependencies(org.neo4j.kernel.impl.util.Dependencies) ClusterClientModule(org.neo4j.cluster.client.ClusterClientModule) FormattedLogProvider(org.neo4j.logging.FormattedLogProvider)

Example 3 with FormattedLogProvider

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

the class ConfigurableStandalonePageCacheFactory method createPageCache.

/**
     * Create page cache
     * @param fileSystem file system that page cache will be based on
     * @param pageCacheTracer global page cache tracer
     * @param pageCursorTracerSupplier supplier of thread local (transaction local) page cursor tracer that will provide
     * thread local page cache statistics
     * @param config page cache configuration
     * @return created page cache instance
     */
public static PageCache createPageCache(FileSystemAbstraction fileSystem, PageCacheTracer pageCacheTracer, PageCursorTracerSupplier pageCursorTracerSupplier, Config config) {
    Config finalConfig = config.withDefaults(MapUtil.stringMap(GraphDatabaseSettings.pagecache_memory.name(), "8M"));
    FormattedLogProvider logProvider = FormattedLogProvider.toOutputStream(System.err);
    ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory(fileSystem, finalConfig, pageCacheTracer, pageCursorTracerSupplier, logProvider.getLog(PageCache.class));
    return pageCacheFactory.getOrCreatePageCache();
}
Also used : Config(org.neo4j.kernel.configuration.Config) PageCache(org.neo4j.io.pagecache.PageCache) FormattedLogProvider(org.neo4j.logging.FormattedLogProvider)

Example 4 with FormattedLogProvider

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

the class ConfigurablePageCacheRule method createPageCache.

private PageCache createPageCache(FileSystemAbstraction fs, PageCacheConfig pageCacheConfig, Config config) {
    PageCacheTracer tracer = selectConfig(baseConfig.tracer, pageCacheConfig.tracer, PageCacheTracer.NULL);
    PageCursorTracerSupplier cursorTracerSupplier = selectConfig(baseConfig.pageCursorTracerSupplier, pageCacheConfig.pageCursorTracerSupplier, DefaultPageCursorTracerSupplier.INSTANCE);
    Config finalConfig = config.withDefaults(MapUtil.stringMap(GraphDatabaseSettings.pagecache_memory.name(), "8M"));
    FormattedLogProvider logProvider = FormattedLogProvider.toOutputStream(System.err);
    ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory(fs, finalConfig, tracer, cursorTracerSupplier, logProvider.getLog(PageCache.class)) {

        @Override
        public int calculatePageSize(Config config, PageSwapperFactory swapperFactory) {
            if (pageCacheConfig.pageSize != null) {
                return pageCacheConfig.pageSize;
            }
            return super.calculatePageSize(config, swapperFactory);
        }
    };
    return pageCacheFactory.getOrCreatePageCache();
}
Also used : PageSwapperFactory(org.neo4j.io.pagecache.PageSwapperFactory) PageCursorTracerSupplier(org.neo4j.io.pagecache.tracing.cursor.PageCursorTracerSupplier) DefaultPageCursorTracerSupplier(org.neo4j.io.pagecache.tracing.cursor.DefaultPageCursorTracerSupplier) Config(org.neo4j.kernel.configuration.Config) PageCacheTracer(org.neo4j.io.pagecache.tracing.PageCacheTracer) ConfiguringPageCacheFactory(org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory) PageCache(org.neo4j.io.pagecache.PageCache) FormattedLogProvider(org.neo4j.logging.FormattedLogProvider)

Example 5 with FormattedLogProvider

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

the class AbstractInProcessServerBuilder method newServer.

@Override
public ServerControls newServer() {
    try (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction()) {
        final OutputStream logOutputStream;
        try {
            logOutputStream = createOrOpenAsOuputStream(fileSystem, new File(serverFolder, "neo4j.log"), true);
        } catch (IOException e) {
            throw new RuntimeException("Unable to create log file", e);
        }
        config.put(ServerSettings.third_party_packages.name(), toStringForThirdPartyPackageProperty(extensions.toList()));
        final FormattedLogProvider userLogProvider = FormattedLogProvider.toOutputStream(logOutputStream);
        GraphDatabaseDependencies dependencies = GraphDatabaseDependencies.newDependencies();
        Iterable<KernelExtensionFactory<?>> kernelExtensions = append(new Neo4jHarnessExtensions(procedures), dependencies.kernelExtensions());
        dependencies = dependencies.kernelExtensions(kernelExtensions).userLogProvider(userLogProvider);
        AbstractNeoServer neoServer = createNeoServer(config, dependencies, userLogProvider);
        InProcessServerControls controls = new InProcessServerControls(serverFolder, neoServer, logOutputStream);
        controls.start();
        try {
            fixtures.applyTo(controls);
        } catch (Exception e) {
            controls.close();
            throw Exceptions.launderedException(e);
        }
        return controls;
    } catch (IOException e) {
        throw Exceptions.launderedException(e);
    }
}
Also used : DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) OutputStream(java.io.OutputStream) IOException(java.io.IOException) KernelExtensionFactory(org.neo4j.kernel.extension.KernelExtensionFactory) AbstractNeoServer(org.neo4j.server.AbstractNeoServer) IOException(java.io.IOException) FormattedLogProvider(org.neo4j.logging.FormattedLogProvider) GraphDatabaseDependencies(org.neo4j.kernel.GraphDatabaseDependencies) File(java.io.File)

Aggregations

FormattedLogProvider (org.neo4j.logging.FormattedLogProvider)5 Config (org.neo4j.kernel.configuration.Config)3 File (java.io.File)2 DefaultFileSystemAbstraction (org.neo4j.io.fs.DefaultFileSystemAbstraction)2 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)2 PageCache (org.neo4j.io.pagecache.PageCache)2 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 ClusterClientModule (org.neo4j.cluster.client.ClusterClientModule)1 NotElectableElectionCredentialsProvider (org.neo4j.cluster.protocol.election.NotElectableElectionCredentialsProvider)1 Args (org.neo4j.helpers.Args)1 PageSwapperFactory (org.neo4j.io.pagecache.PageSwapperFactory)1 PageCacheTracer (org.neo4j.io.pagecache.tracing.PageCacheTracer)1 DefaultPageCursorTracerSupplier (org.neo4j.io.pagecache.tracing.cursor.DefaultPageCursorTracerSupplier)1 PageCursorTracerSupplier (org.neo4j.io.pagecache.tracing.cursor.PageCursorTracerSupplier)1 GraphDatabaseDependencies (org.neo4j.kernel.GraphDatabaseDependencies)1 KernelExtensionFactory (org.neo4j.kernel.extension.KernelExtensionFactory)1 SimpleLogService (org.neo4j.kernel.impl.logging.SimpleLogService)1 ConfiguringPageCacheFactory (org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory)1 Dependencies (org.neo4j.kernel.impl.util.Dependencies)1