Java 类io.vertx.core.logging.SLF4JLogDelegateFactory 实例源码

项目:vertx-jooq-async    文件:VertxDaoTestBase.java   
@BeforeClass
    public static void beforeClass() throws SQLException {
//        TestTool.setupDB();
        System.setProperty("vertx.logger-delegate-factory-class-name", SLF4JLogDelegateFactory.class.getName());
        Configuration configuration = new DefaultConfiguration();
        configuration.set(SQLDialect.MYSQL);

        JsonObject config = new JsonObject().put("host", "127.0.0.1").put("username", "vertx").putNull("password").put("database","vertx");
        dao = new SomethingDao(configuration);
        Vertx vertx = Vertx.vertx();
        dao.setClient(AsyncJooqSQLClient.create(vertx, MySQLClient.createNonShared(vertx, config)));

        compositeDao = new SomethingcompositeDao(configuration);
        compositeDao.setClient(AsyncJooqSQLClient.create(vertx, MySQLClient.createNonShared(vertx, config)));
    }
项目:mpns    文件:AppLauncher.java   
@Override
public void beforeStartingVertx(VertxOptions options) {
    super.beforeStartingVertx(options);
    System.setProperty(LOGGER_DELEGATE_FACTORY_CLASS_NAME, SLF4JLogDelegateFactory.class.getName());
    options.setWarningExceptionTime(
            config.getLong(VERTX_OPTIONS_PROP_PREFIX + "warningExceptionTime", options.getWarningExceptionTime())
    );
}
项目:mesh    文件:LoggingConfigurator.java   
/**
 * Initialize the logback logger and ensure that the logback file is placed in the config folder
 */
public static void init() {

    File logbackFile = new File("config", "logback.xml");
    if (!logbackFile.exists()) {
        writeFile(logbackFile);
    }
    System.setProperty("logback.configurationFile", logbackFile.getAbsolutePath());
    System.setProperty(LoggerFactory.LOGGER_DELEGATE_FACTORY_CLASS_NAME, SLF4JLogDelegateFactory.class.getName());
    LoggerFactory.getLogger(LoggingConfigurator.class);
}
项目:vertx-embedded-mongo-db    文件:EmbeddedMongoVerticle.java   
@Override
public void start() throws Exception {

  if (vertx != null && !context.isWorkerContext()) {
    throw new IllegalStateException("Must be started as worker verticle!");
  }

  JsonObject config = context.config();

  int port = config.getInteger("port", 0);

  IMongodConfig embeddedConfig = new MongodConfigBuilder().
    version(Version.Main.PRODUCTION).
    net(port == 0 ? new Net() : new Net(port, Network.localhostIsIPv6())).
    build();

  Logger logger = (Logger) new SLF4JLogDelegateFactory()
    .createDelegate(EmbeddedMongoVerticle.class.getCanonicalName()).unwrap();

  IRuntimeConfig runtimeConfig = new RuntimeConfigBuilder()
    .defaultsWithLogger(Command.MongoD, logger)
    .build();

  exe = MongodStarter.getInstance(runtimeConfig).prepare(embeddedConfig);
  exe.start();

  actualPort = embeddedConfig.net().getPort();
}
项目:dragoman    文件:Dragoman.java   
public static void main(String[] args) {
  // establish the bridge from vert.x JUL -> SLF4J -> Logback
  System.setProperty(LOGGER_DELEGATE_FACTORY_CLASS_NAME, SLF4JLogDelegateFactory.class.getName());

  new Dragoman().start();
}
项目:wisdom    文件:VertxSingleton.java   
/**
 * Creates and exposed the instance of Vert.X.
 */
@Validate
public void start() {
    final Configuration configuration = appConfiguration.getConfiguration("vertx");


    String log = System.getProperty("org.vertx.logger-delegate-factory-class-name");
    if (log == null) {
        // No logging backend configured, set one:
        System.setProperty("org.vertx.logger-delegate-factory-class-name",
                SLF4JLogDelegateFactory.class.getName());
    }

    VertxOptions options = new VertxOptions();
    boolean clustered = false;
    if (configuration != null) {
        clustered = configuration.getBooleanWithDefault("clustered", false);
        options = new VertxOptions(new JsonObject(configuration.asMap()));

        if (clustered) {
            options
                    .setClustered(true)
                    .setClusterHost(configuration.getOrDie("cluster-host"));
            // Identify port and configuration file
            String clusterConfig = configuration.getWithDefault("cluster-config", "conf/cluster.xml");
            System.setProperty("hazelcast.config", new File(clusterConfig).getAbsolutePath());
        }
    }

    // To setup the logging backend, Vert.x needs a TTCL.
    final ClassLoader tccl = Thread.currentThread().getContextClassLoader();
    try {
        Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());

        Hashtable<String, Object> properties = new Hashtable<>();
        if (clustered) {
            options.setClusterManager(new HazelcastClusterManager());
            String host = options.getClusterHost();
            properties.put("eventbus.host", host);
            Vertx.clusteredVertx(options, ar -> {
                if (ar.failed()) {
                    throw new IllegalStateException("Cannot join cluster", ar.cause());
                }
                vertx = ar.result();
                vertxRegistration = context.registerService(Vertx.class, vertx, properties);
                busRegistration = context.registerService(EventBus.class, vertx.eventBus(), properties);
            });
        } else {
            // Not a clustered environment
            vertx = Vertx.vertx(options);
            vertxRegistration = context.registerService(Vertx.class, vertx, properties);
            busRegistration = context.registerService(EventBus.class, vertx.eventBus(), properties);
        }
    } finally {
        Thread.currentThread().setContextClassLoader(tccl);
    }
}
项目:standalone-hystrix-dashboard    文件:HystrixDashboardLauncher.java   
/**
 * Main Entry-Point, can be runned from IDE too.
 *
 * @param args command line args.
 */
public static void main(String[] args) {
  System.setProperty("vertx.logger-delegate-factory-class-name", SLF4JLogDelegateFactory.class.getName());
  new HystrixDashboardLauncher().dispatch(args);
}