• logj4.xml


     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <!DOCTYPE log4j:configuration PUBLIC "-//log4j/log4j Configuration//EN" "log4j.dtd">
     3 <log4j:configuration>
     4     <!--输出到控制台-->
     5     <appender name="consoleAppender" class="org.apache.log4j.ConsoleAppender">
     6         <param name="Threshold" value="DEBUG"/>
     7         <layout class="org.apache.log4j.PatternLayout">
     8             <param name="ConversionPattern" value="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
     9         </layout>
    10     </appender>
    11 
    12     <!--输出到文件(info)-->
    13     <!--将生成“info.log.2014-06-11”这样的日志文件-->
    14     <appender name="fileAppenderInfo" class="org.apache.log4j.DailyRollingFileAppender">
    15         <param name="File" value="${user.home}/logs/website/info.log" />
    16         <param name="DatePattern" value=".yyyy-MM-dd" />
    17         <layout class="org.apache.log4j.PatternLayout">
    18             <param name="ConversionPattern" value="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
    19         </layout>
    20         <filter class="org.apache.log4j.varia.LevelRangeFilter">
    21             <param name="LevelMin" value="INFO" />
    22             <param name="LevelMax" value="INFO" />
    23         </filter>
    24     </appender>
    25 
    26     <!--输出到文件(warn)-->
    27     <appender name="fileAppenderWarn" class="org.apache.log4j.DailyRollingFileAppender">
    28         <param name="File" value="${user.home}/logs/website/warn.log" />
    29         <param name="DatePattern" value=".yyyy-MM-dd" />
    30         <layout class="org.apache.log4j.PatternLayout">
    31             <param name="ConversionPattern" value="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
    32         </layout>
    33 
    34         <filter class="org.apache.log4j.varia.LevelRangeFilter">
    35             <param name="LevelMin" value="WARN" />
    36             <param name="LevelMax" value="WARN" />
    37         </filter>
    38     </appender>
    39 
    40     <!--输出到文件(error)-->
    41     <appender name="fileAppenderError" class="org.apache.log4j.DailyRollingFileAppender">
    42         <param name="File" value="${user.home}/logs/website/error.log" />
    43         <param name="DatePattern" value=".yyyy-MM-dd" />
    44         <layout class="org.apache.log4j.PatternLayout">
    45             <param name="ConversionPattern" value="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
    46         </layout>
    47         <filter class="org.apache.log4j.varia.LevelRangeFilter">
    48             <param name="LevelMin" value="ERROR" />
    49             <param name="LevelMax" value="ERROR" />
    50         </filter>
    51     </appender>
    52 
    53     <!--屏蔽所有org.springframework.*输出的Debug(及以下)信息-->
    54     <logger name="org.springframework">
    55         <level value="INFO"></level>
    56     </logger>
    57 
    58     <root>
    59         <level value="ALL"/>
    60         <appender-ref ref="consoleAppender" />
    61         <appender-ref ref="fileAppenderInfo" />
    62         <appender-ref ref="fileAppenderWarn" />
    63         <appender-ref ref="fileAppenderError" />
    64     </root>
    65 </log4j:configuration>
  • 相关阅读:
    分页 工具类 前后台代码 Java JavaScript (ajax) 实现 讲解
    java 对小数位的处理 BigDecimal DecimalFormat 常用操作 浅解
    事务 锁 悲观锁 乐观锁 概念 应用场景 使用方式 小记
    多项目使用同一个zookeeper,遇到的坑
    java线程关键字之volatile
    数据库事务
    Web.xml配置详解之context-param
    WINDOWS上KAFKA运行环境安装
    hibernate 之session学习
    windows 安装hadoop
  • 原文地址:https://www.cnblogs.com/tongs/p/7347765.html
Copyright © 2020-2023  润新知