Lookups provide a way to add values to the Log4j configuration at arbitrary places. They are a particular type of Plugin that implements the StrLookup interface. Information on how to use Lookups in configuration files can be found in the Property Substitution section of the Configuration page.
packageorg.example;importorg.apache.logging.log4j.LogManager;importorg.apache.logging.log4j.Logger;publicclassCVE202144228{publicstaticfinalLogger logger =LogManager.getLogger(CVE202144228.class);publicstaticvoidmain(String[]args){String env ="${env:OS}";String date ="${date: MM-dd-yyyy}";logger.error("OS env is {}", env);logger.error("date is {}", date);}}