We have multiple spring mvc applications(war) deployed to weblogic 12c. Each was has dependency to one or two application lib(jar) packaged with it. What we want to do is, create application(war) specific log file and configure it to rotate based on some size and archive it old logs file to some folder.
How it can be achieved in log4j2?
Create separate log4j2.xml configuration files for each web application, each with different target log files. Put the log4j2.xml configuration file in the WAR classpath: under WEB-INF/classes.
Start your log4j2.xml configuration with <Configuration status="trace"
so that log4j2 internal status logs are printed to the console to help troubleshoot any issues.
For more details see https://logging.apache.org/log4j/2.x/manual/webapp.html and https://logging.apache.org/log4j/2.x/manual/logsep.html