[slf4j-user] slf4j and multiple markers

Johan Ström johan at headweb.com
Mon Feb 17 19:57:07 CET 2014


Hi,

I'm trying to find some examples of using "chained" markers (add, 
iterator etc), but I'm coming up short on Google..

What I actually like to do is to mark logging events with one or more 
keywords to tag them in backend storage for easier sorting.
For a single keyword, a simple marker could be used. But I'm not sure 
how to solve it when I need multiple keywords?
Some example keyword combos would be "backend, api", "backend, 
purchase", "api, client, moduleX".

Using chained markers would initially seem like the good solution, but 
as they seem to be cached (via MarkerFactory), the chains would probably 
become mixed up when more than a few places uses keywords in mixed orders.
The getDetachedMarker is one option, creating individual markers every 
time and setting up chain every time.. but that seems like a bit of 
undesired overhead?
Another option would simply be to have a Marker which has all keywords 
in it ("backed,api"), but that seems somewhat counter-intuitive..

Has anyone used markers for a similar scenarios before who could share 
their experience? Or is there perhaps some other good way to solve this?

Thanks
Johan


More information about the slf4j-user mailing list