简体   繁体   English

可以使用默认初始化过程在EJB模块中初始化log4j吗?

[英]Can log4j be initialized in a EJB-module using the default initialization procedure?

In a web-module you can place the log4j.properties on the classpath and log4j's default initialization procedure will use the config, same in a standalone app, no problems here. 在Web模块中,您可以将log4j.properties放在类路径上,并且log4j的默认初始化过程将使用配置,与独立应用程序相同,这里没有问题。

I have though trouble getting it to work in the ejb-module (javaee 1.4) in a EAR-app without programmatic configuration. 尽管没有编程配置,但是我很难让它在EAR应用程序的ejb-module(javaee 1.4)中工作。

So my question is, where to put the log4j.properties file in a ejb-module to avoid programmatic config? 所以我的问题是,将log4j.properties文件放在ejb模块中以避免编程配置?

You should be able to put the Log4J configuration file into the root of the EJB JAR archive. 您应该能够将Log4J配置文件放入EJB JAR归档文件的根目录。 This should work fine. 这应该工作正常。

However I recommend to configure the logging globally for the application server our are using. 但是,我建议为我们正在使用的应用程序服务器全局配置日志记录。 This makes more sense and you won't run into any configuration conflicts this way. 这样更有意义,这样您就不会遇到任何配置冲突。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM