diff --git a/examples/logging/slf4j/README.md b/examples/logging/slf4j/README.md index d9720bfea10..ec016da0c94 100644 --- a/examples/logging/slf4j/README.md +++ b/examples/logging/slf4j/README.md @@ -11,10 +11,10 @@ The example can be built using GraalVM native image as well. Expected output should be similar to the following (for both hotspot and native): ```text 15:40:44.240 INFO [main] i.h.examples.logging.slf4j.Main - Starting up startup -15:40:44.241 INFO [main] i.h.examples.logging.slf4j.Main - Using JUL logger startup +15:40:44.241 INFO [main] i.h.examples.logging.slf4j.Main - Using System logger startup 15:40:44.245 INFO [pool-1-thread-1] i.h.examples.logging.slf4j.Main - Running on another thread propagated -15:40:44.395 INFO [features-thread] io.helidon.common.features.HelidonFeatures - Helidon SE 2.2.0 features: [Config, WebServer] -15:40:44.538 INFO [nioEventLoopGroup-2-1] io.helidon.reactive.webserver.NettyWebServer - Channel '@default' started: [id: 0x8e516487, L:/0:0:0:0:0:0:0:0:8080] +15:40:44.395 INFO [features-thread] i.h.common.features.HelidonFeatures - Helidon NIMA 4.0.0-SNAPSHOT features: [Config, Encoding, Media, WebServer] +15:40:44.538 INFO [main] i.helidon.nima.webserver.LoomServer - Started all channels in 15 milliseconds. 561 milliseconds since JVM startup. Java 20.0.1+9-29 propagated ``` # Running as jar diff --git a/examples/logging/slf4j/pom.xml b/examples/logging/slf4j/pom.xml index 3a4505a43de..fb81df6a3f1 100644 --- a/examples/logging/slf4j/pom.xml +++ b/examples/logging/slf4j/pom.xml @@ -41,8 +41,8 @@ - io.helidon.reactive.webserver - helidon-reactive-webserver + io.helidon.nima.webserver + helidon-nima-webserver io.helidon.logging diff --git a/examples/logging/slf4j/src/main/java/io/helidon/examples/logging/slf4j/Main.java b/examples/logging/slf4j/src/main/java/io/helidon/examples/logging/slf4j/Main.java index c38d1ab793d..ab1bdb3c4b5 100644 --- a/examples/logging/slf4j/src/main/java/io/helidon/examples/logging/slf4j/Main.java +++ b/examples/logging/slf4j/src/main/java/io/helidon/examples/logging/slf4j/Main.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022 Oracle and/or its affiliates. + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,14 +19,13 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; import io.helidon.common.context.Context; import io.helidon.common.context.Contexts; import io.helidon.logging.common.HelidonMdc; import io.helidon.logging.common.LogConfig; -import io.helidon.reactive.webserver.Routing; -import io.helidon.reactive.webserver.WebServer; +import io.helidon.nima.webserver.WebServer; +import io.helidon.nima.webserver.http.HttpRouting; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,18 +54,17 @@ public static void main(String[] args) { // done by the webserver Contexts.runInContext(Context.create(), Main::logging); - WebServer.builder() - .routing(Routing.builder() - .get("/", (req, res) -> { - HelidonMdc.set("name", String.valueOf(req.requestId())); - LOGGER.info("Running in webserver, id:"); - res.send("Hello"); - }) - .build()) - .port(8080) - .build() - .start() - .await(10, TimeUnit.SECONDS); + WebServer server = WebServer.builder() + .routing(Main::routing) + .start(); + } + + private static void routing(HttpRouting.Builder routing) { + routing.get("/", (req, res) -> { + HelidonMdc.set("name", String.valueOf(req.id())); + LOGGER.info("Running in webserver, id:"); + res.send("Hello"); + }); } private static void logging() {