zoukankan      html  css  js  c++  java
  • 【LOG4J】ログ出力の設定方法

    参考URL:

    https://blog.csdn.net/zhengtaoit66/article/details/79551945

    https://www.cnblogs.com/lujiango/p/8573411.html

    http://maven.outofmemory.cn/org.slf4j/slf4j-log4j12/

    https://blog.csdn.net/hzh_csdn/article/details/53282533

    ■インストール方法

    方法一(複数):

    1         <dependency>
    2             <groupId>org.slf4j</groupId>
    3             <artifactId>slf4j-log4j12</artifactId>
    4             <version>1.7.25</version>
    5         </dependency>

    必要なLibファイル:

    log4j-1.2.17.jar + slf4j-log4j12-1.7.25.jar + slf4j-api-1.7.25.jar

    方法二(単一):

    1         <dependency>
    2             <groupId>log4j</groupId>
    3             <artifactId>log4j</artifactId>
    4             <version>1.2.17</version>
    5         </dependency>

    必要なLibファイル:

    log4j-1.2.17.jar

    ■プロパティファイルの設定

    #---------------------------------------------------------------------------------------
    # Logger
    #---------------------------------------------------------------------------------------
    # Root
    log4j.rootLogger=DEBUG,STDOUT, ROOT
    
    #---------------------------------------------------------------------------------------
    # Appender
    #---------------------------------------------------------------------------------------
    # for Root
    log4j.appender.ROOT=org.apache.log4j.ConsoleAppender
    log4j.appender.ROOT.Target=System.out
    log4j.appender.ROOT.layout=org.apache.log4j.PatternLayout
    log4j.appender.ROOT.layout.ConversionPattern=%-5p - %m%n
    
    # for SQL
    log4j.appender.STDOUT=org.apache.log4j.RollingFileAppender
    log4j.appender.STDOUT.File=C:/Users/LNSYLT/Tools/pleiades2018/log/ssm.log
    log4j.appender.STDOUT.Append=true
    log4j.appender.STDOUT.MaxFileSize=1MB
    log4j.appender.STDOUT.MaxBackupIndex=20
    log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
    log4j.appender.STDOUT.layout.ConversionPattern=%d %-5.12p [%C{2}][%F][%M(%L)] - %m%n
  • 相关阅读:
    BZOJ 1036:树的统计Count(树链剖分)
    HDU 5950:Recursive sequence(矩阵快速幂)
    POJ 2763:Housewife Wind(树链剖分)
    HDU 2222:Keywords Search(AC自动机模板)
    HDU 3966:Aragorn's Story(树链剖分)
    矩阵乘法
    HDU 4635:Strongly connected(强连通)
    HDU 3078:Network(LCA之tarjan)
    HDU 2767:Proving Equivalences(强连通)
    HDU 1827:Summer Holiday(强连通)
  • 原文地址:https://www.cnblogs.com/lnsylt/p/10301763.html
Copyright © 2011-2022 走看看