• log4j xml配置



    1. <?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
    2. <log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
    3. <appender name="ConsoleAppender" class="org.apache.log4j.ConsoleAppender">
    4. <layout class="org.apache.log4j.PatternLayout">
    5. <param name="ConversionPattern" value="%d{yyyy-M-d HH:mm:ss}%x[%5p %t](%c:%3L) %m%n" />
    6. </layout>
    7. </appender>
    8. <!-- 输出日志到文件 每天一个文件 -->
    9. <appender name="dailyRollingFile"
    10. class="org.apache.log4j.DailyRollingFileAppender">
    11. <param name="Threshold" value="info"></param>
    12. <param name="ImmediateFlush" value="true"></param>
    13. <param name="File" value="d:/logs/dailyRollingFile.log"></param>
    14. <param name="DatePattern" value="'.'yyyy-MM-dd'.log'"></param>
    15. <layout class="org.apache.log4j.PatternLayout">
    16. <param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss} %-5p] [%t] {%c:%L}-%m%n"></param>
    17. </layout>
    18. </appender>
    19. <!-- 输出日志到文件 文件大小到达指定尺寸的时候产生一个新的文件 -->
    20. <appender name="railyFile"
    21. class="org.apache.log4j.RollingFileAppender">
    22. <param name="File" value="d:/logs/railyFile.log"></param>
    23. <param name="ImmediateFlush" value="true"/>
    24. <param name="Threshold" value="info"></param>
    25. <param name="Append" value="true"></param>
    26. <param name="MaxFileSize" value="30KB"></param>
    27. <param name="MaxBackupIndex" value="100"></param>
    28. <layout class="org.apache.log4j.PatternLayout">
    29. <param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss} %-5p] [%t] {%c:%L}-%m%n"></param>
    30. </layout>
    31. </appender>
    32. <!--然后定义logger,只有定义了logger并引入的appender,appender才会生效 -->
    33. <logger name="org.quartz">
    34. <level value="error" />
    35. </logger>
    36. <logger name="org.springframework.cache">
    37. <level value="info" />
    38. </logger>
    39. <logger name="org.apache">
    40. <level value="error" />
    41. </logger>
    42. <logger name="com.opensymphony.xwork2">
    43. <level value="error" />
    44. </logger>
    45. <!-- Do1平台日志 -->
    46. <logger name="cn.com.do1">
    47. <level value="debug" />
    48. </logger>
    49. <!-- 控制台输出日志 -->
    50. <root>
    51. <level value="info" />
    52. <appender-ref ref="ConsoleAppender" />
    53. <appender-ref ref="dailyRollingFile" />
    54. <appender-ref ref="railyFile" />
    55. </root>
    56. </log4j:configuration>

  • 相关阅读:
    Circular dependency issuse on cocoapods version(0.36.0) 全然解决方式(非降版本号)
    Android Studio经常使用配置及使用技巧(二)
    poj 2195 Going Home(最小费最大流)
    OpenFace库(Tadas Baltrusaitis)中基于Haar Cascade Classifiers进行人脸检測的測试代码
    Divisibility by Eight
    hdu 5055(坑)
    微服务(Microservices)
    mysql 运行计划explain具体解释
    URAL 题目1297. Palindrome(后缀数组+RMQ求最长回文子串)
    Windows下将nginx安装为服务运行
  • 原文地址:https://www.cnblogs.com/signheart/p/6597933.html
Copyright © 2020-2023  润新知