I'd like to set dynamically the fileName where the FileAppender will write. I'll provide an example of my configuration.
log4j2.yml
...
Appenders:
Console:
name: Console_Appender
target: SYSTEM_OUT
PatternLayout:
pattern: "[%-5level] %d{dd-MM-yyyy HH:mm:ss.SSS} [%t] %c{1} - %msg%n"
File:
name: File_Appender
fileName: ${log-path}/fileLog.log
PatternLayout:
pattern: "[%-5level] %d{dd-MM-yyyy HH:mm:ss.SSS} [%t] %c{1} - %msg%n"
...
I'd like fileLog${javaVariable}.log where javaVariable is dynamic. Is this possible?
Thank you :)
EDIT: To be clear I need that if the method that I intercept with @Around annotation is called by the user0 I have to write the (single) log in "user0.log"; if is called by user1 -> "user1.log". I can create users at any time so I need a dynamic filename.