Spring JpetStore ---- log4j的配置
来源:互联网 发布:数控机床螺纹编程 编辑:程序博客网 时间:2024/05/22 10:37
Spring JpetStore ---- log4j的配置
问题的提出:
log4j不能输入信息.
问题的解决:
1、首先弄清 webAppRootKey 所表示的含义。
<!--如果不定义webAppRootKey参数,那么webAppRootKey就是缺省的"webapp.root"-->
定义完成后就可以在properties文件中用"${} "的方式加以引用了。
定义完成后就可以在properties文件中用"${} "的方式加以引用了。
如:在 jpetstore的文件中我这样定义:
<display-name>Spring JPetStore</display-name>
<description>Spring JPetStore sample application</description>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>petstore.root</param-value>
</context-param>
<description>Spring JPetStore sample application</description>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>petstore.root</param-value>
</context-param>
在log4j.properties文件中:
log4j.appender.logfile.File=${petstore.root}/WEB-INF/petstore.log
可以这样引用。
2、在web.xml文件中加入监听。
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
3、log4j.properties文件在webinf下,而不是在web-inf/classes下。并不是说非得放在这里。这与
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.properties</param-value>
</context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.properties</param-value>
</context-param>
这配置相关
- Spring JpetStore ---- log4j的配置
- Spring JPetStore学习(一)配置JPetStore
- Spring的log4j配置
- 学习Spring附带源码jpetstore安装配置
- spring 中log4j的配置
- Spring搭建:log4j的配置
- JPetStore中Struts和Spring的整合
- 基于Spring例子的JPetStore分析
- 学习Spring 附带源码jpetstore 一 安装配置篇
- Spring-1.2.8 中 jpetstore项目安装配置
- Spring例子JPetStore分析---------3jpetstore的各层之间的关系部分分析
- 关于spring的log4j的配置问题
- 简单介绍Log4J的使用和Spring 配置log4j
- Spring 配置log4j和简单介绍Log4J的使用
- Spring 配置log4j和简单介绍Log4J的使用
- Spring 配置log4j和简单介绍Log4J的使用
- Spring 配置log4j和简单介绍Log4J的使用
- Spring 配置log4j和简单介绍Log4J的使用
- WordPress 开发者工具箱(下)
- DB2常用的命令
- Rails源代码分析(8):ActionController::Filter(2)
- 将字符型转换为整型
- 自己写的js备份
- Spring JpetStore ---- log4j的配置
- 【zz-中电信189号段将在北京放号】
- C++学习推荐书目
- C#经典书籍
- Moss 2007 的几个编程技巧
- Struts和Spring的区别?
- java获取路径的几种途径
- s900 初始 出厂设置
- winrar命令行