I have been looking over these three sites on how to create a map lookup (or any other lookup for that matter) using log4j2:
- http://logging.apache.org/log4j/2.x/manual/extending.html#Lookups
- http://logging.apache.org/log4j/2.x/manual/lookups.html
- http://logging.apache.org/log4j/2.x/manual/configuration.html#PropertySubstitution
I understand the general idea behind what I am reading, I am just having a difficult time putting all the bits and pieces together.
Goal
To be able to place a variable, of some sort, in a log4j2.xml file that at configuration time, or runtime, replaces that variable with the values in a resource bundle. This is what i have so far:
Configuration File
Lookup Class
The getValue(key) method looks in a resource bundle for the email values associated with that key.The @Plugin name is "map" which, if i have read correctly, is related to prefixes in the .xml file that are also "map". So, wouldn't "error.notification.emails" get passed into the lookup(String key) method in the MapPropertiesLookup class? What do i need to do in order to get this to work?