You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The JsonProvider interface currently extends Lifecycle. This means that Logback will call its start() method just after configuration properties are set. This is a standard pattern in the Logback ecosystem and works ok for most JsonProvider except a few like GlobalCustomFieldsJsonProvider and PatternJsonProvider.
These two providers need a JsonFactory to parse the value of some of their configuration properties. The factory is not provided by Logback but by the component to which the JsonProvider will be assigned. It is therefore not available at the time Logback calls the start() method. Parsing of the JSON properties is therefore delayed until a JsonFactory is set and will never happen during the lifecycle of component. As a comment already says in the source code, "parsing cannot occur during start() because the jsonFactory is not already set when Logback invokes the method".
Lifecycle of JsonProvider should be entirely delegated to the CompositeJsonFormatter or NestedJsonProvider to which they are assigned without Logback interfering at any time. These two components already call the start/stop method at the appropriate time and take care of assigning a JsonFactory before start() is invoked.
The conclusion is that JsonProvider(s) should not implement the Logback Lifecycle interface at all. This is totally useless since nothing will be done because the JsonFactory is not already set. This also makes the code more complex and moves the validation of the component state outside of the start() method where it usually goes.
The text was updated successfully, but these errors were encountered:
…tring
Issue #680: no auto-start of JsonProviders
- remove Lifecycle from the JsonProvider interface to prevent Logstash from auto-starting the provider
- declare the start/stop method initially defined by the Lifecycle interface in the JsonProvider interface
- now that start() is called only once, parse the JSON string during start()
Issue #679: remaining characters after reading JSON string
- raise an error if some characters remain after reading a JsonNode out of the string
Issue #680: no auto-start of JsonProviders
- remove Lifecycle from the JsonProvider interface to prevent Logstash from auto-starting the provider
- declare the start/stop method initially defined by the Lifecycle interface in the JsonProvider interface
- now that start() is called only once, parse the JSON string during start()
Issue #679: remaining characters after reading JSON string
- raise an error if some characters remain after reading a JsonNode out of the string
The
JsonProvider
interface currently extendsLifecycle
. This means that Logback will call itsstart()
method just after configuration properties are set. This is a standard pattern in the Logback ecosystem and works ok for most JsonProvider except a few likeGlobalCustomFieldsJsonProvider
andPatternJsonProvider
.These two providers need a JsonFactory to parse the value of some of their configuration properties. The factory is not provided by Logback but by the component to which the JsonProvider will be assigned. It is therefore not available at the time Logback calls the
start()
method. Parsing of the JSON properties is therefore delayed until a JsonFactory is set and will never happen during the lifecycle of component. As a comment already says in the source code, "parsing cannot occur during start() because the jsonFactory is not already set when Logback invokes the method".Lifecycle of JsonProvider should be entirely delegated to the CompositeJsonFormatter or NestedJsonProvider to which they are assigned without Logback interfering at any time. These two components already call the start/stop method at the appropriate time and take care of assigning a JsonFactory before start() is invoked.
The conclusion is that JsonProvider(s) should not implement the Logback Lifecycle interface at all. This is totally useless since nothing will be done because the JsonFactory is not already set. This also makes the code more complex and moves the validation of the component state outside of the start() method where it usually goes.
The text was updated successfully, but these errors were encountered: