zoukankan      html  css  js  c++  java
  • log4j

    pro

    log4j.appender.atguigu.File=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.atguigu.File.file=d:\atguigu.log
    log4j.appender.atguigu.File.DatePattern=.yyyy-MM-dd
    log4j.appender.atguigu.File.layout=org.apache.log4j.PatternLayout
    log4j.appender.atguigu.File.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %5p (%C{1}:%M) - %m%n
    
    log4j.appender.atguigu.Console=org.apache.log4j.ConsoleAppender 
    log4j.appender.atguigu.Console.layout=org.apache.log4j.PatternLayout    
    log4j.appender.atguigu.Console.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %5p (%C:%M) - %m%n 
    
    
    log4j.rootLogger=warn,atguigu.Console,atguigu.File
    #u540eu9762u8fd8u6709u5148u4e0du770b
    
    
    
    
    
    
    
    
    
    #log4j.logger.com.atguigu=warn,atguigu.Console,atguigu.File
    
    
    #log4j.logger.com.atguigu.dao=debug,atguigu.Console,atguigu.File

    xml:

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
    
    
    <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
    
        <appender name="log.console" class="org.apache.log4j.ConsoleAppender">
            <layout class="org.apache.log4j.PatternLayout">
                <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %5p (%C{1}:%M) - %m%n" />
            </layout>
            <!-- 
            <filter class="org.apache.log4j.varia.LevelRangeFilter"> 
                    <param name="levelMin"         value="warn" /> 
                    <param name="levelMax"         value="warn" /> 
                    <param name="AcceptOnMatch" value="true" /> 
            </filter>
            -->
        </appender>
    
        <appender name="log.file" class="org.apache.log4j.DailyRollingFileAppender">
            <param name="File"             value="D:\atguigu4XML.log" />
            <param name="Append"         value="true" />
            <param name="DatePattern"     value="'.'yyyy-MM-dd" />
            <layout class="org.apache.log4j.PatternLayout">
                <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %5p (%C{1}:%M) - %m%n" />
            </layout>
            <!-- <filter class="org.apache.log4j.varia.LevelRangeFilter"> 
                    <param name="levelMin"         value="info" /> 
                    <param name="levelMax"         value="info" /> 
                    <param name="AcceptOnMatch" value="true" /> 
                </filter> -->
        </appender>
        <!-- -->
        <logger name="com.atguigu" additivity="false">
            <level value="info" />
            <appender-ref ref="log.console" />
            <appender-ref ref="log.file" />
        </logger>
         
        <logger name="com.atguigu.dao" additivity="false">
            <level value="debug" />
            <appender-ref ref="log.console" />
            <appender-ref ref="log.file" />
        </logger>
        <!-- -->
        <root>
            <level value="debug" />
            <appender-ref ref="log.console" />
            <appender-ref ref="log.file" />
        </root>     
     
    
    </log4j:configuration>

    %m 输出代码中指定的消息
    %p 输出优先级,即DEBUG,INFO,WARN,ERROR,FATAL
    %r 输出自应用启动到输出该log信息耗费的毫秒数
    %c 输出所属的类目,通常就是所在类的全名
    %t 输出产生该日志事件的线程名
    %n 输出一个回车换行符,Windows平台为“ ”,Unix平台为“ ”
    %d 输出日志时间点的日期或时间,默认格式为ISO8601,也可以在其后指定格式,
    比如:%d{yyyy-MM-dd HH:mm:ss,SSS},输出类似:2015-12-20 18:35:51,768

  • 相关阅读:
    thinkphp 关联
    php io
    phpstorm 生产php pojo类
    解决在mysql表中删除自增id数据后,再添加数据时,id不会自增1的问题
    thinkphp model
    thinkphp 数据库连接报错 SQLSTATE[HY000] [2002] No such file or directory
    thinkphp获取目录的方法
    thinkphp数据库连接
    css3背景颜色渐变属性
    CentOS开机自动运行自己的脚本详解
  • 原文地址:https://www.cnblogs.com/buxiu/p/10781589.html
Copyright © 2011-2022 走看看