log4j2 - generate application specific log files in weblogic

孤街醉人 提交于 2020-01-05 03:57:12

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/38053283/log4j2-generate-application-specific-log-files-in-weblogic

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!