-
Notifications
You must be signed in to change notification settings - Fork 82
Closed
Description
Hi,
I'm considering to add a feature that will add trace support for JUL when JUL is called from SLF4J. This can be done using the MDC.getCopyOfContextMap method from SLF4j. This is useful for javaee projects that want to keep using the logging framework of their application server (which is often JUL, unfortunately).
Below is a code snippet that shows how this could be implemented
Map<String, String> copyOfContextMap = MDC.getCopyOfContextMap();
copyOfContextMap.forEach((k, v) -> {
System.out.println("key: " + k + ", value: " + v);
});
System.out.println(copyOfContextMap.get("trace.id"));
System.out.println(copyOfContextMap.get("transaction.id"));
I can implement this by making a new formatter e.g. JuLSlf4jEcsFormatter that extends the JuLEcsFormatter, or I can edit the current JuLEcs formatter.
Which solution do you guys prefer? I prefer the last one but wanted to be sure before I write the code :)
Metadata
Metadata
Assignees
Labels
No labels