Skip to content

raushan606/quarkus-logging-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maven Central

Quarkus Logging Json

Quarkus logging extension outputting the logging in json.

Version to use

Quarkus Version Use version
3.x.x 3.x.x

Configuration

The extension is enabled by default for console, when added to the project. Console logging can be disabled using configuration: quarkus.log.json.console.enable=false

Custom log handler

If you want to add your own custom way to handle the LogRecords. You can create your own implementations of fish.payara.loggingjson.JsonProvider, and provide it using CDI. Example implementation:

import jakarta.inject.Singleton;
import java.io.IOException;

import fish.payara.loggingjson.JsonProvider;
import fish.payara.loggingjson.JsonGenerator;
import org.jboss.logmanager.ExtLogRecord;

@Singleton
public class MyJsonProvider implements JsonProvider {

    @Override
    public void writeTo(JsonGenerator generator, ExtLogRecord event) throws IOException {
        generator.writeStringField("myCustomField", "and my custom value"); // Will be added to every log, as a field on the json.
    }
}

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Simon Bengtsson

💻 🚧

This project follows the all-contributors specification. Contributions of any kind welcome!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages