In my java program I want to use several log files.
So according to the log4j documentation I would assume that lookup values are use to do that.
The Lookups page describe how to build the configuration files. But has only little information about how to store the values so that the configuration file is retrieving the values.
So I want to have logfilename dynamically filled.
Test with envrimonment works:
<File name="MyFile" fileName="${env:USERERNAME}" immediateFlush="false" append="false">
<PatternLayout pattern="%d{yyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</File>
I would assume that System.getProperty("USER") would match the java lookup ${java:USER} but it does not work.
I tested both variables using:
System.out.println("USER: " + System.getProperty("USER"));
System.out.println("USERNAME: " + System.getenv("USERNAME"));
So how to fill the variables for
- Context Map Lookup
- Java lookup
Which are the differences?