Interface JsonProvider


public interface JsonProvider
Provides a mechanism to add custom JSON fields to log records on a per-record basis. Implementations will be called for each log record during JSON formatting, allowing dynamic, per-record injection of custom JSON keys and values.

Implementations can be registered in two ways:

  • Via the Java ServiceLoader mechanism by creating a META-INF/services/io.quarkus.logging.json.runtime.JsonProvider file listing the fully-qualified class names of all implementations.
  • As CDI beans (e.g. @ApplicationScoped) when running in a CDI environment such as Quarkus with the Arc extension.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    writeTo(JsonFormatter.JsonLogGenerator generator, org.jboss.logmanager.ExtLogRecord record)
    Called for each log record to add custom JSON fields.
  • Method Details

    • writeTo

      void writeTo(JsonFormatter.JsonLogGenerator generator, org.jboss.logmanager.ExtLogRecord record) throws Exception
      Called for each log record to add custom JSON fields.
      Parameters:
      generator - the JSON generator to write fields to; excluded keys configured via quarkus.log.*.json.excluded-keys are still filtered
      record - the log record being formatted
      Throws:
      Exception - if an error occurs during field generation