Is there is a way to set up google cloud logging for quarkus?

1.1k views Asked by At

The only thing stopping me from using quarkus on my projects is the lack of google cloud logging support.

https://cloud.google.com/logging/docs/setup/java

Because google cloud logging use Logback appender for cloud logging, and quarkus use JBoss Logging.

Is there is a way to fix that? Or maybe some workaround?

Thank you

1

There are 1 answers

0
Jyothi Kiranmayi On

StackDriver will make the log lines appear in Google Cloud Logging.

Quarkus supports several logging APIs: JUL (java.util.logging), JBoss Logging, SLF4J and Apache Commons Logging.

java.util.logging configuration (JUL):

Logging handlers can be added programmatically or by using a configuration file. The path to the configuration file must be provided to your application as a system property: -Djava.util.logging.config.file=/path/to/logging.properties You can use the JUL handler com.google.cloud.logging.LoggingHandler

JBoss Logging:

Internally Quarkus uses JBoss Logging; you can also use it inside your application so that no other dependencies should be added for your logs.

Note : If you use JBoss Logging but one of your libraries uses a different logging API, you may need to configure a Logging adapter.

SLF4J :

Using the Logback appender, you can use Cloud Logging with the SLF4J logging facade.

Once you have configured Logback to use the Cloud Logging Logback appender, you can now redirect logs using the SLF4J logging API. The snippet shows how to log using the SLF4J facade within your application.

Refer this guide for more information on Quarkus about configuring logs