Details
Description
I'm trying to create a Log4j2 configuration file that will create a log file using DateLookup so that the current date and time are in the filename (so it matches the logging used in our other products). This is what the appender configuration looks like:
<FastRollingFile name="Rolling" fileName="log/$${date:yyyyMMdd-HHmmss} - myApp.log" filePattern="log/$${date:yyyyMMdd-HHmmss} - myApp-%i.log"> <immediateFlush>true</immediateFlush> <suppressExceptions>false</suppressExceptions> <PatternLayout> <pattern>%d %p %c{1.} [%t] $${env:USER} %m%n</pattern> </PatternLayout> <Policies> <OnStartupTriggeringPolicy /> <SizeBasedTriggeringPolicy size="100 MB"/> </Policies> </FastRollingFile>
However when the log file is generated the filename is "${date". I've tried different variations and haven't been able to get this lookup to work at all.