zoukankan      html  css  js  c++  java
  • log4J日志输出修改

    1、

    log4j.rootLogger=DEBUG,INFO, console, log, error
    
    ###Console ###
    log4j.appender.console = org.apache.log4j.ConsoleAppender
    log4j.appender.console.Target = System.out
    log4j.appender.console.layout = org.apache.log4j.PatternLayout
    log4j.appender.console.layout.ConversionPattern = %d %p[%C:%L]- %m%n
    
    ### log ###
    log4j.appender.log = org.apache.log4j.DailyRollingFileAppender
    log4j.appender.log.File =d:/jsxf/mobile/logs/debug.log
    log4j.appender.log.Append = true
    log4j.appender.log.Threshold = INFO
    log4j.appender.log.DatePattern='_'yyyy-MM-dd'.log'
    log4j.appender.logFile.ImmediateFlush=true 
    log4j.appender.log.layout = org.apache.log4j.PatternLayout
    log4j.appender.log.layout.ConversionPattern = %d %p[%c:%L] - %m%n
    
    
    ### Error ###
    log4j.appender.error = org.apache.log4j.DailyRollingFileAppender
    log4j.appender.error.File = d:/jsxf/mobile/logs/error.log
    log4j.appender.error.Append = true
    log4j.appender.error.Threshold = ERROR
    log4j.appender.error.DatePattern='_'yyyy-MM-dd'.log'
    log4j.appender.error.layout = org.apache.log4j.PatternLayout
    log4j.appender.error.layout.ConversionPattern =%d %p[%c:%L] - %m%n
    
    ###u8F93u51FASQL
    log4j.logger.com.ibatis=DEBUG
    log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG
    log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG
    log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
    log4j.logger.com.pro.mapper = DEBUG
    log4j.logger.java.sql.Connection=DEBUG
    log4j.logger.java.sql.Statement=DEBUG
    log4j.logger.java.sql.PreparedStatement=DEBUG

    2、java代码方法中使用

    private static Logger logger = Logger.getLogger(TransferHandleController.class.getName());
    logger.error("xxx转办时异常", e);
  • 相关阅读:
    POJ 1003 解题报告
    POJ 1004 解题报告
    POJ-1002 解题报告
    vi--文本编辑常用快捷键之光标移动
    常用图表工具
    September 05th 2017 Week 36th Tuesday
    September 04th 2017 Week 36th Monday
    September 03rd 2017 Week 36th Sunday
    September 02nd 2017 Week 35th Saturday
    September 01st 2017 Week 35th Friday
  • 原文地址:https://www.cnblogs.com/wmqiang/p/11679005.html
Copyright © 2011-2022 走看看