Open alexanderjastram opened 5 months ago
@alexanderjastram Thank you for this report. Could you please provide a patch or a PR?
will do - I'll post it here once its done
@alexanderjastram No need to provide a full implementation. Just the gist of the api you wish to see.
Currently, only the regular property map is exposed in the MDCAdapter, and formatters such as the LogStashFormatter use the properties defined there to add additional tags to logs. This makes it impossible to have stack-based logger context, since children can potentially overwrite the context of their parents.
For example:
would result in the following logs:
Now using the dequed properties we can keep track of the parent property instead of overwriting it:
Ideally this would result in the following logs:
Unfortunately, the key value pairs of the dequeue map are not exposed, so the example above cannot be implemented. If it was exposed we could make a custom JSONProvider that provides the tags from the dequed map.