What I have now in my config file
{
"type":"RollingFile",
"name": "machineLog",
"ThresholdFilter": { "level": "debug" },
"JsonLayout":{"complete":"true"},
"Policies":
{
"SizeBasedTriggeringPolicy": {"size":"100M"}
},
"fileName": "${sys:my.logging.directory}/machine.json",
"filePattern":"${sys:my.logging.directory}/RolledLogs/$${date:yyyy}/$${date:MM}/%d{yyyy-MM-dd-HH}-machine.json.gz"
}
I want the rolled file (filePattern
entry) to contain a UNIX timestamp. Since this is legal I tried changing that line to be
"filePattern":"${sys:my.logging.directory}/RolledLogs/$${date:yyyy}/$${date:MM}/%d{UNIX}-machine.json.gz"
Figuring that since %d{UNIX}
was mentioned in the Layout documentation page for log4j2
it would work.
The result is that it creates the unrolled machine.json file but seems to not be able to append to it. It remains at zero bytes even when I flood the system with things that normally generates a ton of logs with the original config.
What's going on here? How can I achieve the effect I want?