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);
}
}
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());
}
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();
}
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();
}
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);
}
}
Aggregations