Web工程部署到WebLogic9.2配置Log4j问题
使用commons-logging接口管理log4j打印日志
?
现象:
1.开发中使用tomcat作应用服务器,只要吧log4j.properties放到src下即可正确的打印出日志。
2.开发中使用WebLogic9.2作为应用服务器
a)发布成Exploded Archive,打印日志正常
b)发布成Packaged Archive,不能打印日志
怀疑打包后WebLogic不能读取log4j配置文件
?
public void init() throws ServletException { InputStream is = getServletContext().getResourceAsStream( "/WEB-INF/classes/log4j.properties"); Properties props = new Properties(); try { props.load(is); } catch (IOException e) { System.err.println("Load log4j configuration failed"); } PropertyConfigurator.configure(props); }
?
?
?并注册到web.xml中?
?
?
?