Skip to content

FluentdAppender does not properly handle MDC #4

@AixNPanes

Description

@AixNPanes

The following code:

for (String mdcKey : mdcKeys.split(","))
{
  Object value = event.getMDC(mdcKey);
  if (value != null)
  {
    data.put(mdcKey, value);
  }
}

can be replaced by

for(Map.Entry<String, Object> entry:((Hashtable<String, Object>)MDC.getContext()).entrySet())
{
    if (entry.getValue() != null)
        data.put(entry.getKey(), entry.getValue());
}

This seems to fix the problem for me, although it may not be efficient.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions