1、导入包log4j-1.2.17.jar

<dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

2、创建并设置log4j.properties

log4j.rootLogger=info,fileLogger
log4j.appender.fileLogger=org.apache.log4j.DailyRollingFileAppender
log4j.appender.fileLogger.DatePattern='.'yyyy-MM-dd-HH
log4j.appender.fileLogger.File=G:/po/apache-tomcat-7.0.79/logs/error.log
log4j.appender.fileLogger.layout=org.apache.log4j.PatternLayout
log4j.appender.fileLogger.layout.ConversionPattern=[%d{yyyy-MM-dd HH\:mm\:ss}]\: %-5r [%-5p] %m%n

3、测试类

4、日志信息

LOG4J spring与mybatis整合的更多相关文章

  1. Mybatis学习(7)spring和mybatis整合

    整合思路: 需要spring通过单例方式管理SqlSessionFactory. spring和mybatis整合生成代理对象,使用SqlSessionFactory创建SqlSession.(spr ...

  2. 框架篇:Spring+SpringMVC+Mybatis整合开发

    前言: 前面我已搭建过ssh框架(http://www.cnblogs.com/xrog/p/6359706.html),然而mybatis表示不服啊. Mybatis:"我抗议!" ...

  3. spring 和 mybatis 整合过程 (包含分页)

    1.spring-mybatis.xml  : 配置 SqlSessionFactory 和  MapperScannerConfigurer  <bean id="sqlSessio ...

  4. Spring+springmvc+Mybatis整合案例 annotation版(myeclipse)详细版

    Spring+springmvc+Mybatis整合案例 Version:annotation版 文档结构图: 从底层开始做起: 01.配置web.xml文件 <?xml version=&qu ...

  5. Spring+springmvc+Mybatis整合案例 xml配置版(myeclipse)详细版

    Spring+springmvc+Mybatis整合案例 Version:xml版(myeclipse) 文档结构图: 从底层开始做起: 01.配置web.xml文件 <?xml version ...

  6. Spring与Mybatis整合的MapperScannerConfigurer处理过程源码分析

    前言 本文将分析mybatis与spring整合的MapperScannerConfigurer的底层原理,之前已经分析过java中实现动态,可以使用jdk自带api和cglib第三方库生成动态代理. ...

  7. Mybatis学习--spring和Mybatis整合

    简介 在前面写测试代码的时候,不管是基于原始dao还是Mapper接口开发都有许多的重复代码,将spring和mybatis整合可以减少这个重复代码,通过spring的模板方法模式,将这些重复的代码进 ...

  8. 九 spring和mybatis整合

    1       spring和mybatis整合 1.1     整合思路 需要spring通过单例方式管理SqlSessionFactory. spring和mybatis整合生成代理对象,使用Sq ...

  9. SpringMVC, Spring和Mybatis整合案例一

    一  准备工作 包括:spring(包括springmvc).mybatis.mybatis-spring整合包.数据库驱动.第三方连接池. 二  整合思路 Dao层: 1.SqlMapConfig. ...

随机推荐

  1. VBA注释临时

    Sub shishi() '按ABCDE为多选题定义答案; 'A.沙利度胺 B.异烟肼 C.利福平 'd.氯法齐明 E.氨苯砜 '46.各型麻风病的首选药物为(D) 'A.沙利度胺 B.异烟肼 C.利 ...

  2. python学习笔记--smtp模块的使用及常见错误处理

    SMTPAuthenticationError: (535, 'Error: \xc7\xeb\xca\xb9\xd3\xc3\xca\xda\xc8\xa8\xc2\xeb\xb5\xc7\xc2\ ...

  3. DOM节点的增删改查

    在开始展开DOM操作前,首先需要构建一棵DOM树. <!DOCTYPE html> <html lang="en"> <head> <me ...

  4. 各种 Java Thread State【转载】

    1,线程状态为“waiting for monitor entry”: 意味着它 在等待进入一个临界区 ,所以它在”Entry Set“队列中等待. 此时线程状态一般都是 Blocked: java. ...

  5. freemarker ,DEFAULT_INCOMPATIBLE_IMPROVEMENTS 找不到

    一般出现这种问题的原因是,spring的版本和freemarker不匹配造成的~ nested exception is org.springframework.beans.factory.BeanC ...

  6. java的super和this关键字用法总结

    ------super关键字------                 super用途:在子类中访问超类“被隐藏的成员变量(无论是否静态)和静态方法”以及“被重写的实例方法”.这里的超类必须是“直接 ...

  7. CSS3 盒阴影(box-shadow)详解

    CSS3 的 box-shadow 有点类似于 text-shadow,只不过不同的是 text-shadow 是对象的文本设置阴影,而 box-shadow 是给对象实现图层阴影效果.本文我们搁下I ...

  8. WARN hdfs.DFSClient: Caught exception java.lang.InterruptedException

    Hadoop 2.7.4 The reason is this: originally, DataStreamer::closeResponder always prints a warning ab ...

  9. uva-10392-因数分解

    #include<stdio.h> #include<iostream> #include<queue> #include<memory.h> #inc ...

  10. 查看shell环境下,网络是否连通-curl/ping

    检查网络是否可用 curl www.baidu.com <!--STATUS OK--><html>...</html> ping www.baidu.com注意: ...