Details
Description
It is not possible to use the Main Arguments Lookup in the current version. The "main" prefix is not present in the corresponding Interpolator object and thus the resolution of the variable is not working as advertised in the documentation, e.g. using the following variable in the log4j2.xml:
${main:0}
As far as I can tell, the problem seems to stem from the PluginManger.collectPlugins-Method that does not acknowledge the existence of the Main Arguments Lookup.
I'm following the documentation on the website with the following sample log4j2.xml:
<File name="GLOBAL" fileName="${env:DATA_DIR}/log/${env:APP_NAME}.log" > <PatternLayout pattern="%m%n" header="File: ${main:0}" /> ...
...and following code in my application:
public static void main(String[] args) { MapLookup.setMainArguments(args); ...