-
Hi, When using both slf4j logger and StructuredArguments, I realised that if I want to log a message and enhance the JSON event with the fields from my POJO like this
I get a warning telling me that I didn't provide any placeholder in the message for the fields, but I don't want this. Indeed, it would be redundant to have the fields added both in the message and as separated fields in my JSON.
which gives me a compilation error because it excepts a Marker. Thing is that this is indeed what is returned by your function but the specification of the method is signed with the interface, not the Marker type. It therefore requires a cast at user level which is, as you could imagine, not really clean. Is there a specific reason for this design ? Do you think it could be possible to return the concrete type instead of the interface ? As an example, a possible fix for the fields() method would be to switch from
to
Regards, Jeremy |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi Jeremy, When using markers, use the static methods in |
Beta Was this translation helpful? Give feedback.
Hi Jeremy,
When using markers, use the static methods in
net.logstash.logback.marker.Markers
instead of the ones innet.logstash.logback.argument.StructuredArguments