io.vertx.core.logging.SLF4JLogDelegateFactory Java Examples

The following examples show how to use io.vertx.core.logging.SLF4JLogDelegateFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Runner.java    From vxms with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
    // Use logback for logging
    File logbackFile = new File("config", "logback.xml");
    System.setProperty("logback.configurationFile", logbackFile.getAbsolutePath());
    System.setProperty(LoggerFactory.LOGGER_DELEGATE_FACTORY_CLASS_NAME, SLF4JLogDelegateFactory.class.getName());
    Logger log = LoggerFactory.getLogger(Runner.class);

    // Setup the http server
    log.info("Starting server for: http://localhost:8080/hello");
    Vertx vertx = Vertx.vertx();
    Router router = Router.router(vertx);

    router.route("/hello").handler(rc -> {
        log.info("Got hello request");
        rc.response().end("World");
    });

    vertx.createHttpServer()
            .requestHandler(router::accept)
            .listen(8080);

}
 
Example #2
Source File: LauncherUtils.java    From konduit-serving with Apache License 2.0 5 votes vote down vote up
/**
 * This sets some of the common properties for vertx and logs. This will set the working directory
 * for vertx and channels the vertx related logs to the logback configuration that konduit-serving
 * utilizes.
 */
public static void setCommonLoggingAndVertxProperties() {
    setProperty(LOGGER_DELEGATE_FACTORY_CLASS_NAME, SLF4JLogDelegateFactory.class.getName());
    LoggerFactory.getLogger(LoggerFactory.class); // Required for Logback to work in Vertx

    setProperty("vertx.cwd", DirectoryFetcher.getWorkingDir().getAbsolutePath()); // For setting the vertx working directory for runtime files.
    setProperty(CACHE_DIR_BASE_PROP_NAME, DirectoryFetcher.getWorkingDir().getAbsolutePath()); // For setting caching directory for vertx related optimizations.
}
 
Example #3
Source File: AppLauncher.java    From mpns with Apache License 2.0 5 votes vote down vote up
@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())
    );
}
 
Example #4
Source File: HystrixDashboardLauncher.java    From standalone-hystrix-dashboard with MIT License 2 votes vote down vote up
/**
 * 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);
}