Log4j的配置

# Global logging configuration
log4j.rootLogger=ERROR, ooo

# MyBatis logging configuration...
log4j.logger.com.wgc.uploadAndDownload.dao=DEBUG

# 规则1,名字为 ooo,向标准输出 System.err/out
log4j.appender.ooo=org.apache.log4j.ConsoleAppender
log4j.appender.ooo.layout=org.apache.log4j.PatternLayout
log4j.appender.ooo.layout.ConversionPattern=%5p [%t] ~ %m%n

# 规则2,输出为文件
log4j.appender.000=org.apache.log4j.FileAppender
log4j.appender.000.File=d:/log/log.out
log4j.appender.000.layout=org.apache.log4j.PatternLayout
log4j.appender.000.layout.conversionPattern=%m %n

# 规则3,输出到数据库
log4j.appender.o0o=org.apache.log4j.jdbc.JDBCAppender
log4j.appender.o0o.URL=jdbc:mariadb://localhost/lagou
log4j.appender.o0o.driver=org.mariadb.jdbc.Driver
log4j.appender.o0o.user=vip
log4j.appender.o0o.password=vip
log4j.appender.o0o.layout=org.apache.log4j.PatternLayout
log4j.appender.o0o.sql=INSERT INTO LOGS VALUES('%t')

 

 

MyBatis中配置

<settings>
        <!-- 使用jdbc的getGeneratedKeys获取数据库自增主键值 -->
        <setting name="useGeneratedKeys" value="true" />
        <!-- 使用列别名替换列名 默认:true -->
        <setting name="useColumnLabel" value="true" />
        <!-- 开启驼峰命名转换:Table {create_time} -> Entity {createTime} -->
        <setting name="mapUnderscoreToCamelCase" value="true" />
        <!--配置日志-->
        <setting name="logImpl" value="LOG4J"></setting>
    </settings>

 

posted @ 2018-11-16 07:47  YouAreABug  阅读(188)  评论(0编辑  收藏  举报