log4j2-在weblogic中生成应用程序特定的日志文件 [英] log4j2 - generate application specific log files in weblogic

查看:409
本文介绍了log4j2-在weblogic中生成应用程序特定的日志文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有多个spring mvc应用程序(war)部署到了weblogic 12c.每个文件都依赖于与其一起打包的一个或两个应用程序li​​b(jar).我们要做的是,创建特定于应用程序(战争)的日志文件,并将其配置为根据一定的大小轮换,然后将旧的日志文件存档到某个文件夹中.

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.

如何在log4j2中实现它?

How it can be achieved in log4j2?

推荐答案

为每个Web应用程序创建单独的log4j2.xml配置文件,每个文件具有不同的目标日志文件.将log4j2.xml配置文件放在WAR类路径中:WEB-INF/classes下.

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.

使用<Configuration status="trace"启动log4j2.xml配置,以便将log4j2内部状态日志打印到控制台,以帮助解决任何问题.

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.

有关更多详细信息,请参见 https://logging.apache.org/log4j/2.x/manual/webapp.html https ://logging.apache.org/log4j/2.x/manual/logsep.html

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

这篇关于log4j2-在weblogic中生成应用程序特定的日志文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆