From taguspoudel at gmail.com Fri Mar 1 12:42:40 2019 From: taguspoudel at gmail.com (Sugat Poudel) Date: Fri, 1 Mar 2019 12:42:40 -0500 Subject: [undertow-dev] Configuring log levels Message-ID: <51578AE3-1D97-4D54-9C40-D03FE5286776@gmail.com> Hello all, I noticed that the UndertowLogger is using the jboss logging classes. What is the best way to configure log levels as it seems to be defaulting to DEBUG. I couldn?t find any specific documentation online and most were suggesting using a properties file. Ideally, I would like to configure the levels in code so that we can change log levels in production without having to restart the server. ? Sugat From ckozak at ckozak.net Fri Mar 1 13:24:41 2019 From: ckozak at ckozak.net (Carter Kozak) Date: Fri, 01 Mar 2019 13:24:41 -0500 Subject: [undertow-dev] Configuring log levels In-Reply-To: <51578AE3-1D97-4D54-9C40-D03FE5286776@gmail.com> References: <51578AE3-1D97-4D54-9C40-D03FE5286776@gmail.com> Message-ID: <2cf49378-0990-469e-b0d0-b04de7769c8d@www.fastmail.com> jboss-logging, much like slf4j, is a logging API which may be configured for other backends. If you have log4j2, logback, or log4j on your classpath jboss-logging should delegate to it, and configuration is handled by the logging implementation the same way you would configure it for the rest of the application. -ck On Fri, Mar 1, 2019, at 12:42, Sugat Poudel wrote: > Hello all, > > I noticed that the UndertowLogger is using the jboss logging classes. What is the best > way to configure log levels as it seems to be defaulting to DEBUG. I couldn?t find any specific documentation online and most were suggesting using a properties file. > > Ideally, I would like to configure the levels in code so that we can change log levels in production without having to restart the server. > > ? Sugat > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From bill at dartalley.com Wed Mar 13 22:38:15 2019 From: bill at dartalley.com (Bill O'Neil) Date: Wed, 13 Mar 2019 22:38:15 -0400 Subject: [undertow-dev] Delay execution of a HttpHandler In-Reply-To: References: Message-ID: Thanks for the suggestions Carter this is what I came up with let me know if anything stands out as being incorrect. I was getting an error if I did not call unDispatch and this seems to work. *public* *void* handleRequest(HttpServerExchange exchange) *throws* Exception { Duration duration = durationFunc.apply(exchange); *final* HttpHandler delegate; *if* (exchange.isBlocking()) { // We want to undispatch here so that we are not blocking // a worker thread. We will spin on the IO thread using the // built in executeAfter. exchange.unDispatch(); delegate = *new* BlockingHandler(next); } *else* { delegate = next; } exchange.dispatch(exchange.getIoThread(), () -> { exchange.getIoThread().executeAfter(() -> Connectors.*executeRootHandler*(delegate, exchange), duration.toMillis(), TimeUnit.*MILLISECONDS*); }); } https://www.stubbornjava.com/posts/creating-a-non-blocking-delay-in-the-undertow-web-server-for-artificial-latency#delay-handler-implementation Thanks, Bill On Fri, Jan 4, 2019 at 9:33 AM Carter Kozak wrote: > Perhaps some thing along these lines: > > public void handleRequest(HttpServerExchange exchange) throws Exception { > exchange.dispatch(SameThreadExecutor.INSTANCE, () -> { > exchange.getIoThread().executeAfter(() -> > Connectors.executeRootHandler(handler, exchange), > duration, unit); > }); > } > > > > On Fri, Jan 4, 2019 at 12:53 AM Bill O'Neil wrote: > > > > Hello, > > > > I'm looking for a way to add artificial latency to requests and I'm > having trouble finding a way that wouldn't require a blocking pool with 1 > thread per request. > > > > What I would like to happen if possible. > > > > handler marks exchange as not ready (yield / pause) > > async runnable from another thread marks it ready to resume after some > time > > next iteration of IO loop catches that it is ready and actually executes > it now. > > > > > > public void handle(HttpServerExchange exchange) { > > if (firstExecution) { > > scheduledExec.schedule(() -> exchange.resume(), duration, unit); > > return; > > } > > next.handle(exchange); > > } > > > > Is something like this possible while staying on the IO threads the > whole time other than the ScheduledExecutorService? I was thinking of using > dispatch and dispatching back to the IO executor but I don't think that > will do what I intend. > > > > The end goal would be a way to handle N requests with various delays > built in to simulate latency without blocking connections. For instance if > the worker pool has 30 threads and I submit 100 requests with a 1 minute > delay followed by 1 request with a 10 second delay the final request should > come back first. > > > > Thanks, > > Bill > > _______________________________________________ > > undertow-dev mailing list > > undertow-dev at lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/undertow-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20190313/39481631/attachment.html