I have a log4j2.xml config file in the class path. One of the appenders is a File appender, and I would like to set the target file name at run time in the Java application
What you can do is, when running the application, pass logFilename as an argument to the JVM:
logFilename
java -DlogFilename=myAppName.log -jar /path/to/myApp.jar