以下配置工作时,我在本地机器上部署WEP的应用程序(窗口)Log4j配置在JSF的Web应用程序
public void contextInitialized(ServletContextEvent sce) {
Logger logger = null;
ServletContext servletContext = sce.getServletContext();
String prefix = servletContext.getRealPath("/");
String log4jFile = servletContext.getInitParameter("log4j");
if (log4jFile != null) {
DOMConfigurator.configure(prefix + log4jFile);
logger = LogManager.getLogger(StartupListener.class.getName());
logger.info("LOG4J loaded successfully: " + log4jFile);
}
}
<context-param>
<param-name>log4j</param-name>
<param-value>WEB-INF/classes/com/domain/resources/log4j.xml</param-value>
</context-param>
<listener>
<listener-class>com.domain.util.StartupListener</listener-class>
</listener>
但在Linux中安装Web应用程序时,我得到了以下错误信息:
log4j:ERROR Could not parse file [nullWEB-INF/classes/com/domain/resources/log4j.xml].
java.io.FileNotFoundException: /app/home/wdmt3/AdminServer/nullWEB-INF/classes/com/domain/resources/log4j.xml (No such file or directory)
有什么建议吗?
我不使用spring,基本上唯一有效的选择是在weblogic中将服务器日志记录选项更改为log4j – angus 2013-03-21 13:30:46
您是否尝试过解决方案中的代码?实际上你不需要使用弹簧。 – 2013-03-21 15:01:35
你是什么意思“log4jFile以'/'开头? – angus 2013-03-21 15:21:33