Java log4j在带有Spring的JAX-WS中不能正常工作

Java log4j在带有Spring的JAX-WS中不能正常工作,java,web-services,log4j,websphere,jax-ws,Java,Web Services,Log4j,Websphere,Jax Ws,我使用Spring设置了一个JAX-WS,除了log4j之外,其他一切都可以工作: 我遵循官方的sping文件: 其端点定义如下: import org.springframework.web.context.support.SpringBeanAutowiringSupport; @WebService(serviceName="AccountService") public class AccountServiceEndpoint extends SpringBeanAutowiring

我使用Spring设置了一个JAX-WS,除了log4j之外,其他一切都可以工作:

我遵循官方的sping文件:

其端点定义如下:

import org.springframework.web.context.support.SpringBeanAutowiringSupport;

@WebService(serviceName="AccountService")
public class AccountServiceEndpoint extends SpringBeanAutowiringSupport {

@Autowired
private AccountService biz;

@WebMethod
public void insertAccount(Account acc) {
   biz.insertAccount(acc);
}
然后我尝试在AccountService的impl中写入日志:

public class AccountServiceImpl implements AccountService {
    private static Logger logger =   Logger.getLogger(AccountServiceImpl.class.getName()); 
     ... 
     public void insertAccount(Account acc) {
         logger.debug("someting... " ) 
         ....
     }   
 }
和在web.xml中

<context-param>   
 <param-name>log4jConfigLocation</param-name>   
 <param-value>classpath:my_log4j.xml</param-value>
 </context-param>
 <listener>   
  <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
 </listener> 

log4jConfigLocation
类路径:my_log4j.xml
org.springframework.web.util.Log4jConfigListener
我已经测试了我的_log4j.xml,配置是绝对正确的,并且我在启动时也得到了日志,显示我的_log4j.xml是在WebApplicationContext init之前加载的

我想知道是不是因为WebService的Spring快用完了,然后log4jConfigLocation就不工作了


我正在使用的服务器是Websphere Application server 7.0,通过将类加载器策略更改为PARENT_LAST,question closed,最终得到修复。您的一个依赖项是否将Log4j作为依赖项?是的,当然,我可以在WEB-INF/lib folder中看到Log4j jar这不是我所问的问题。在你的项目中是否还有其他依赖项也使用log4j?哦,对不起,对于你的问题,我想没有,因为这个应用程序在没有log4j的情况下工作得很好,这并不意味着什么。当一些内部log4j配置与项目的log4j配置fyi发生冲突时,我们通常会遇到这个问题,这应该是最后的手段,并且通常有另一种方法让log4j在WebSphere下与第三方libs一起工作。