Skip to content

MutableContextMapFilter - property resolution for 'configLocation' attribute #3087

@JWT007

Description

@JWT007

This is just a suggestion for a possible improvement

According to the Log4j 2.x documentation for MutableContextMapFilter:

https://logging.apache.org/log4j/2.x/manual/filters.html#MutableThreadContextMapFilter

A 'configLocation' can be specified for the external JSON configuration map and can be a URI or a Path.

Looking at the code for MutableThreadContextMapFilter it appears that there is no property resolution performed on this attribute.

Conceivable is that a property is either specified in the configuration XML/JSON or provided by a Log4j PropertySource to provide a path determined at runtime. Often a application might be installed on differnt paths and the configLocation might be relative to a base-path or via a spring property or such.

   <Property name="contextMapPath">C:/foo/bar/contextMaps</Property>
   <MutableContextMapFilter configLocation="${contextMapPath}/foobar.json"/>
   <MutableContextMapFilter configLocation="${contextMapPath}/wingding.json"/>

Property resolution in the config location might be a useful feature.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions