Class DeferredStructuredArgument

java.lang.Object
net.logstash.logback.argument.DeferredStructuredArgument
All Implemented Interfaces:
StructuredArgument

public class DeferredStructuredArgument extends Object implements StructuredArgument
A StructuredArgument that defers the creation of another StructuredArgument until the first time its value is needed.

The value is needed in the following conditions:

The deferred value will always be created in the thread calling the Logger (even if an async appender is used) since the values of structured arguments are needed when LoggingEvent.prepareForDeferredProcessing() is called (by async appenders prior to dispatching the event to another thread).

The deferred value will only be calculated once. The single value supplied by the supplier will be reused every time the structured argument is written. For example, if multiple appenders use a logstash encoder, the supplier will be invoked when the first appender encodes the marker. That same supplied value will be used when the next appender encodes the marker.