[slf4j-user] FYI - structured logging wrapper for SLF4J

Ceki ceki at qos.ch
Wed Oct 9 21:25:50 CEST 2019


Hi Jordan,

Thank you for reaching out with such a meaningful contribution.

I have looked at Mapple with some interest but not long enough to 
actually understand what was really going on in the code. I hope to 
remedy that shortly and come back with meaningful comments.

In the mean time, it should be said that structured logging is something 
that SLF4J should most definitely support. (Some people also talk about 
high cardinality logging.)

Best,
--
Ceki Gülcü

On 01.10.2019 22:15, Jordan Zimmerman wrote:
>> because then you can use that S.fluent().call().chain() code in other 
>> contexts 
> 
> I see. You can actually decouple, though it might need a bit more work 
> depending on what you need. For example, the lambda can be defined 
> independently. E.g.
> 
> Statement<Schema> s = s -> s.name(foo).age(bar);
> 
> This statement can then be re-used and even extended. There's an example 
> here - 
> https://github.com/Randgalt/maple/blob/master/maple-examples/src/main/java/com/myco/app/request/UpdateService.java. 
> 
> 
> Maple has a bunch on internal utils that could be useful outside of 
> logging. For example, you can convert a statement lambda into a list of 
> Names/Values via the MapleSpi factory. E.g.
> 
> // save this meta instance somewhere
> var metaIInstance = MapleSpi.instance().generate(Schema.class);
> 
> // convert a statement into names/values
> var instance = metaInstance.newSchemaInstance();
> s.handle(instance);
> var namesValues = metaIInstance.toNamesValues(instance);
> 
> If this became a desired idiom I could make a little utility for this bit.
> 
>> OT3H I may be moving towards log4j2 in the next months anyway
> 
> FWIW - I wrote Maple in an implementation neutral way. It would be very 
> easy to add a direct Log4J2 backend for it. Just a few classes to implement.
> 
> -JZ
> 


More information about the slf4j-user mailing list