在weblogic中使用多个log4j.xml的多个应用程序[英] multiple applications with multiple log4j.xml in weblogic

本文是小编为大家收集整理的关于在weblogic中使用多个log4j.xml的多个应用程序的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

i在Weblogic-Server上的一个域中部署多个应用程序(EAR).每个应用程序都使用log4j. 我的希望是用自己的log4j.xml配置每个应用程序.这可能吗? log4j.xml应该在耳朵外面,以便我可以编辑它而不重建耳朵.

我用来将log4j.xml放入服务器ClassPath中,然后在服务器启动上读取.但是然后我没有可能为每个应用程序使用不同的log4j.xml.

我认为这是一个类问题,因为log4j在类路径中搜索log4j.xml.但是我不知道,如何在不同的应用程序中使用不同的类路径.

推荐答案

我认为除非使用log4j.xml文件包装,否则将不同的log4j.xml文件用于相同的weblogic服务器上的不同应用程序.

那么,可能是您可以为不同的应用程序拥有不同的登录器吗?这样相同的log4j.xml可以通过不同的应用程序使用,但是应用程序使用的记录器定义可能会有所不同.

其他推荐答案

um,确保可以从不同的文件(例如log4j-app1.xml和log4j-app2.xml)配置log4j.您可以每个应用程序配置servlet.请参阅此我发表的其他帖子.

中的详细信息

但是,我也建议将它们全部放在一个文件中,就像这里已经提出的那样.

.

本文地址:https://www.itbaoku.cn/post/1574944.html

问题描述

I deploy multiple applications (ear) in one domain on a Weblogic-Server. Each application uses log4j. My wish is to configure each applications with its own log4j.xml. Is this possible? The log4j.xml should be outside of the ear, so that I can edit it without rebuilding the ear.

I'm used to put the log4j.xml in the serverclasspath, then it is read on server startup. But then I don't have the possibility to use different log4j.xml for each application.

I think it is a classpath issue, because log4j search for the log4j.xml in the classpath. But I don't know, how to uses different classpath for different applications.

推荐答案

I don't think its possible to have different log4j.xml files for different applications deployed on the same WebLogic server unless the log4j.xml files are packaged with ear itself.

So, may be you can have different loggers for different applications? That way same log4j.xml can be used by different applications but the logger definitions the applications use can differ.

其他推荐答案

Um, sure it is possible, if you configure the log4j by yourself from different files (such as log4j-app1.xml and log4j-app2.xml). You could have a configuring servlet per app. See details in this other post I made.

However, having them all in a one file, like already proposed here, is something I would also recommend.