本文整理汇总了Java中org.neo4j.logging.slf4j.Slf4jLogProvider类的典型用法代码示例。如果您正苦于以下问题:Java Slf4jLogProvider类的具体用法?Java Slf4jLogProvider怎么用?Java Slf4jLogProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Slf4jLogProvider类属于org.neo4j.logging.slf4j包,在下文中一共展示了Slf4jLogProvider类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dbFactory
import org.neo4j.logging.slf4j.Slf4jLogProvider; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private Block dbFactory(final Path dbdir, final String dbkey) {
return unit -> {
GraphDatabaseService dbservice = unit.registerMock(GraphDatabaseService.class);
// unit.mockStatic(RuntimeRegistry.class);
// expect(RuntimeRegistry.getStartedRuntime(dbservice)).andReturn(null);
LinkedBindingBuilder<GraphDatabaseService> lbb = unit.mock(LinkedBindingBuilder.class);
lbb.toInstance(dbservice);
Binder binder = unit.get(Binder.class);
expect(binder.bind(Key.get(GraphDatabaseService.class))).andReturn(lbb);
ServiceKey keys = unit.get(ServiceKey.class);
keys.generate(eq(GraphDatabaseService.class), eq(dbkey), unit.capture(Consumer.class));
GraphDatabaseBuilder dbbuilder = unit.registerMock(GraphDatabaseBuilder.class);
expect(dbbuilder.newGraphDatabase()).andReturn(dbservice);
GraphDatabaseFactory factory = unit.constructor(GraphDatabaseFactory.class)
.build();
expect(factory.setUserLogProvider(isA(Slf4jLogProvider.class))).andReturn(factory);
expect(factory.newEmbeddedDatabaseBuilder(dbdir.toFile())).andReturn(dbbuilder);
};
}
示例2: newEmbeddedDb
import org.neo4j.logging.slf4j.Slf4jLogProvider; //导入依赖的package包/类
/**
* Creates a new embedded db in the neoRepository folder.
*
* @param eraseExisting if true deletes previously existing db
*/
public GraphDatabaseBuilder newEmbeddedDb(File storeDir, boolean eraseExisting) {
if (eraseExisting && storeDir.exists()) {
// erase previous db
LOG.debug("Removing previous neo4j database from {}", storeDir.getAbsolutePath());
FileUtils.deleteQuietly(storeDir);
}
GraphDatabaseBuilder builder = new GraphDatabaseFactory()
.setUserLogProvider(new Slf4jLogProvider())
.newEmbeddedDatabaseBuilder(storeDir)
.setConfig(GraphDatabaseSettings.keep_logical_logs, "false")
.setConfig(GraphDatabaseSettings.pagecache_memory, mappedMemory + "m");
if (shell) {
LOG.info("Enable neo4j shell on port " + port);
builder.setConfig(ShellSettings.remote_shell_enabled, "true")
.setConfig(ShellSettings.remote_shell_port, String.valueOf(port))
// listen to all IPs, not localhost only
.setConfig(ShellSettings.remote_shell_host, "0.0.0.0");
}
return builder;
}
示例3: initGraphDatabaseService
import org.neo4j.logging.slf4j.Slf4jLogProvider; //导入依赖的package包/类
protected void initGraphDatabaseService() {
if (databasePath == null) {
databasePath = new File(configuration.getDatabasePath());
}
if (graphDatabase == null) {
if (configuration.hasHaconfig()) {
TinkerPopConfig.HaConfig haconfig = configuration.getHaconfig();
LOG.info(
"Launching HA mode. Server id is " +
haconfig.getServerId() +
" database is at " +
databasePath.getAbsolutePath() +
". allow init cluster is " +
haconfig.allowInitCluster()
);
final GraphDatabaseBuilder graphDatabaseBuilder =
new HighlyAvailableGraphDatabaseFactory()
.setUserLogProvider(new Slf4jLogProvider())
.newEmbeddedDatabaseBuilder(databasePath)
.setConfig(GraphDatabaseSettings.allow_store_upgrade, "true")
.setConfig(ClusterSettings.allow_init_cluster, haconfig.allowInitCluster())
.setConfig(ClusterSettings.server_id, haconfig.getServerId())
.setConfig(ClusterSettings.initial_hosts, haconfig.getInitialHosts())
.setConfig(ClusterSettings.cluster_server, haconfig.getIp() + ":5001")
.setConfig(HaSettings.ha_server, haconfig.getIp() + ":6001")
/*
* Neo4j synchronizes the slave databases via pulls of the master data. By default this property is not
* activated (set to 0s). So this property has to be set. An alternative is to set 'ha.tx_push_factor'.
* Since a network connection might be temporarily down, a pull is safer then a push. The push_factor is
* meant for ensuring data duplication so that a master can safely crash
*/
.setConfig(HaSettings.pull_interval, haconfig.getPullInterval())
.setConfig(HaSettings.tx_push_factor, haconfig.getPushFactor());
if (configuration.getPageCacheMemory().length() > 0) {
graphDatabaseBuilder.setConfig(GraphDatabaseSettings.pagecache_memory, configuration.getPageCacheMemory());
}
graphDatabase = graphDatabaseBuilder.newGraphDatabase();
} else {
LOG.info("Launching local non-ha mode. Database at " + databasePath.getAbsolutePath());
graphDatabase = new GraphDatabaseFactory()
.setUserLogProvider( new Slf4jLogProvider() )
.newEmbeddedDatabaseBuilder(databasePath)
.setConfig(GraphDatabaseSettings.allow_store_upgrade, "true")
.newGraphDatabase();
}
}
}