1.将 commons-logging.jar和 log4j.jar加入你的项目中;
2.在src/下创建log4j.properties|log4j.xml文件;
3.在web.xml中配置log4j的信息,如下:
<context-param>
  <param-name>log4jConfigLocation</param-name>
  <param-value>/WEB-INF/classes/log4j.properties</param-value>
   </context-param>
<listener>
  <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>

注意:红色代码是固定的,log4jConfigLocation就是用来加载log4j文件的固定名。

web.xml中配置log4j的更多相关文章

  1. 在web.xml中配置error-page

    在web.xml中配置error-page 在web.xml中有两种配置error-page的方法,一是通过错误码来配置,而是通过异常的类型来配置,分别举例如下: 一.   通过错误码来配置error ...

  2. web.xml中配置Spring中applicationContext.xml的方式

    2011-11-08 16:29 web.xml中配置Spring中applicationContext.xml的方式 使用web.xml方式加载Spring时,获取Spring applicatio ...

  3. web.xml 中配置了error-page但不起作用问题

    问题: 在web.xml 中配置了 error-page,但是好像不起作用,就是跳转不到指定的页面. 配置信息如下: <!-- 400错误 --> <error-page> & ...

  4. struts2 在 Action 或 Interceptor 中获取 web.xml 中配置的 <context-param> 参数 (这是我的第一篇博文,哈哈。)

    最近为了改一个问题,想加一个控制开关,就在web.xml 中配置了一个 <context-param> 参数,并在 Action 或 Interceptor 中获取参数值. 1.在 web ...

  5. 在web.xml中配置监听器来控制ioc容器生命周期

    5.整合关键-在web.xml中配置监听器来控制ioc容器生命周期 原因: 1.配置的组件太多,需保障单实例 2.项目停止后,ioc容器也需要关掉,降低对内存资源的占用. 项目启动创建容器,项目停止销 ...

  6. 在哪个web.xml中配置welcome页面

    是在tomcat的web.xml中配置,而不是在你的%web-project-root%/WEB-INF/web.xml中! 示例 <welcome-file-list> <welc ...

  7. 在web.xml中配置SpringMVC

    代码如下 <servlet> <servlet-name>springMVC</servlet-name> <servlet-class>org.spr ...

  8. web.xml中配置启动时加载的servlet,load-on-starup

    web.xml中配置启动时加载的servlet,load-on-starup 使用servlet来初始化配置文件数据: 在servlet的配置当中,<load-on-startup>1&l ...

  9. web.xml中配置固定数据

    在web.xml单个servlet中配置的数据的存取 存: <servlet> <description>This is the description of my J2EE ...

随机推荐

  1. js复制对象 和 节点类型和NodeList

    1. myList.cloneNode(true); 在参数为true的情况下,执行深复制,也就是复制节点及其整个子节点树,包括属性 2. myList.cloneNode(false); 在参数为f ...

  2. CSS定义网页滚动条

    (一)滚动条样式主要涉及到如下CSS属性: overflow属性: 检索或设置当对象的内容超过其指定高度及宽度时如何显示内容overflow: auto; 在需要时内容会自动添加滚动条overflow ...

  3. [0] Tornado Todo 开篇

    参考自: python: tornado例子 Github地址:tornado_todo 开发环境: Python包的安装: 首先安装 pip: sudo apt-get install python ...

  4. c语言中的结构体指针类型的cast

    1.我们在c语言中会经常碰到强制类型转换. 在这,我介绍一种结构pointer类型转换,但是有前提(有点类似于c++中的继承中的子父对象的cast). 简单的介绍一下: 首先我们要知道一个结构的指针, ...

  5. hdu 1245 Saving James Bond

    http://acm.hdu.edu.cn/showproblem.php?pid=1245 #include <cstdio> #include <cstring> #inc ...

  6. BZOJ 1061 志愿者招募

    http://www.lydsy.com/JudgeOnline/problem.php?id=1061 思路:可以用不等式的改装变成费用流. 将不等式列出,如果有负的常数,那么就从等式连向T,如果是 ...

  7. htpasswd.cgi 网页远程修改gerrit ht 认证的密码文件

    在搭建gerrit系统时,一般都会采用apache的.htacces 认证方法 但trac本身并不提供修改密码的功能,修改密码只能通过htpasswd/htpasswd2命令来进行,这的确是一件相当不 ...

  8. 2013第49周三IE9文档模式

    今天完善了原有模块的代码和注释,然后继续之前新模块的开发,并写了两边的service接口,除了因为邮件中有部分问题让我分心外,专心下来写代码的感觉真好,今天基本上没遇到多少让我新感悟的技术问题,就总结 ...

  9. 4Sum 解答

    Question Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c  ...

  10. Ajax_post发送

    $('#img_file_del_3').click(function() { var data={name:$('#img_file_del_3').attr('name')}; var url=' ...