本文介绍了Weblogic中具有多个log4j.xml的多个应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Weblogic-Server的一个域中部署了多个应用程序(耳朵).每个应用程序都使用log4j.我的愿望是使用自己的log4j.xml配置每个应用程序.这可能吗?log4j.xml应该放在耳朵外面,这样我就可以编辑它而无需重建耳朵.

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.

我习惯将log4j.xml放在serverclasspath中,然后在服务器启动时读取它.但是然后我就无法为每个应用程序使用不同的log4j.xml.

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.

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

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.

推荐答案

除非将log4j.xml文件打包到耳朵上,否则我认为不可能为部署在同一WebLogic服务器上的不同应用程序使用不同的log4j.xml文件.本身.

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.

那么,您可能为不同的应用程序使用了不同的记录器吗?这样,不同的应用程序可以使用相同的log4j.xml,但是应用程序使用的记录器定义可以不同.

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.

这篇关于Weblogic中具有多个log4j.xml的多个应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 04:32