我使用Spring设置了一个JAX-WS,除了log4j之外还有其他工作:
我正在关注官方sping文档: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/remoting.html#remoting-web-services-jaxws-export-servlet
,其中Endpoint的定义如下:
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>
我测试了my_log4j.xml,配置是绝对正确的,我还在启动时登录,显示在WebApplicationContext init之前加载了my_log4j.xml
我想知道是否因为WebService正在运行Spring而log4jConfigLocation无法正常工作
我使用的服务器是Websphere Application Server 7.0
答案 0 :(得分:1)
最后通过将类加载器策略更改为PARENT_LAST来解决,问题已关闭