Currently the DynamicThresholdFilter only supports key values pairs in the ThreadContextMap. It would be good to see this expanded to include all log4j2 lookups.
In the below example the threshold level would be stored in a map value substituted at runtime.
Alternatively, allow the threshold filter to be substituted with a runtime lookup value.
The above will allow the developer to customise the log level at runtime across various loggers, appenders etc.