Package io.quarkus.logging.json.runtime
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
ServiceLoadermechanism by creating aMETA-INF/services/io.quarkus.logging.json.runtime.JsonProviderfile 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 TypeMethodDescriptionvoidwriteTo(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 viaquarkus.log.*.json.excluded-keysare still filteredrecord- the log record being formatted- Throws:
Exception- if an error occurs during field generation
-