Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the log level during runtime in Quarkus

Tags:

quarkus

I am looking for a way to change the log level of one or multiple classes/packages of a Quarkus app (JVM) during runtime. Is there an API I can use to programmatically change the levels, e.g. by exposing a REST API or does there already exist some other solution?

I am aware of https://quarkus.io/guides/logging but this only discusses changing the log levels statically via a JVM property or applications.properties.

like image 846
Seb T Avatar asked Aug 04 '20 16:08

Seb T


People also ask

Can we change log level at runtime?

In terms of scaling, the challenge is to change log levels in each instance. So to avoid all pitfalls following is needed: Dynamically change the log level at runtime without application restart. Propagation of log level changes across the application instances.

How do you change the logging level?

To change log levels as a root user, perform the following: To enable debug logging, run the following command: /subsystem=logging/root-logger=ROOT:change-root-log-level(level=DEBUG) To disable debug logging, run the following command: /subsystem=logging/root-logger=ROOT:change-root-log-level(level=INFO)

How do I change log level in Log4j?

Setting Levels using Configuration File log4j provides you configuration file based level setting which sets you free from changing the source code when you want to change the debugging level. Following is an example configuration file which would perform the same task as we did using the log. setLevel(Level.


1 Answers

For future readers: I created a Quarkus extension that can be seen here: https://github.com/quarkiverse/quarkiverse-logging-ui

And can be used by adding this dependency

      <dependency>
          <groupId>io.quarkiverse.loggingui</groupId>
          <artifactId>quarkus-logging-ui</artifactId>
          <version>0.0.2</version>
      </dependency>
like image 156
JSBach Avatar answered Oct 23 '22 05:10

JSBach