问答详情
源自:4-1 转账环境的搭建

og4jshu文件

log4j:WARN No appenders could be found for logger (org.springframework.test.context.junit4.SpringJUnit4ClassRunner). log4j:WARN Please initialize the log4j system properly.

提问者:qq_年少无多时_0 2019-03-01 11:26

个回答

  • jisu_che
    2019-03-01 18:53:38
    已采纳

    log4j.rootLogger=DEBUG,Console
    log4j.appender.Console=org.apache.log4j.ConsoleAppender
    log4j.appender.Console.layout=org.apache.log4j.PatternLayout
    log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n
    log4j.logger.org.apache=INFO


  • 炼哥
    2019-07-09 14:18:56

    log4j.rootLogger=CONSOLE,FILE  

    log4j.addivity.org.apache=true  

      

    # \u5E94\u7528\u4E8E\u63A7\u5236\u53F0  

    log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender  

    log4j.appender.CONSOLE.Threshold=INFO  

    log4j.appender.CONSOLE.Target=System.out  

    log4j.appender.CONSOLE.Encoding=GBK

    log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout  

    log4j.appender.CONSOLE.layout.ConversionPattern=[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n  

      

    # \u6BCF\u5929\u65B0\u5EFA\u65E5\u5FD7  

    log4j.appender.A1=org.apache.log4j.DailyRollingFileAppender  

    log4j.appender.A1.File=C:/log4j/log  

    log4j.appender.A1.Encoding=GBK

    log4j.appender.A1.Threshold=DEBUG  

    log4j.appender.A1.DatePattern='.'yyyy-MM-dd  

    log4j.appender.A1.layout=org.apache.log4j.PatternLayout  

    log4j.appender.A1.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L : %m%n  

      

    #\u5E94\u7528\u4E8E\u6587\u4EF6  

    log4j.appender.FILE=org.apache.log4j.FileAppender  

    log4j.appender.FILE.File=C:/log4j/file.log  

    log4j.appender.FILE.Append=false  

    log4j.appender.FILE.Encoding=GBK

    log4j.appender.FILE.layout=org.apache.log4j.PatternLayout  

    log4j.appender.FILE.layout.ConversionPattern=[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n  

      

    # \u5E94\u7528\u4E8E\u6587\u4EF6\u56DE\u6EDA  

    log4j.appender.ROLLING_FILE=org.apache.log4j.RollingFileAppender  

    log4j.appender.ROLLING_FILE.Threshold=ERROR  

    log4j.appender.ROLLING_FILE.File=rolling.log  

    log4j.appender.ROLLING_FILE.Append=true  

    log4j.appender.CONSOLE_FILE.Encoding=GBK 

    log4j.appender.ROLLING_FILE.MaxFileSize=10KB  

    log4j.appender.ROLLING_FILE.MaxBackupIndex=1  

    log4j.appender.ROLLING_FILE.layout=org.apache.log4j.PatternLayout  

    log4j.appender.ROLLING_FILE.layout.ConversionPattern=[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n  

      

    #\u81EA\u5B9A\u4E49Appender  

    log4j.appender.im = net.cybercorlin.util.logger.appender.IMAppender  

    log4j.appender.im.host = mail.cybercorlin.net  

    log4j.appender.im.username = username  

    log4j.appender.im.password = password  

    log4j.appender.im.recipient = yyflyons@163.com  

    log4j.appender.im.layout=org.apache.log4j.PatternLayout  

    log4j.appender.im.layout.ConversionPattern =[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n  

      

    #\u5E94\u7528\u4E8Esocket  

    log4j.appender.SOCKET=org.apache.log4j.RollingFileAppender  

    log4j.appender.SOCKET.RemoteHost=localhost  

    log4j.appender.SOCKET.Port=5001  

    log4j.appender.SOCKET.LocationInfo=true  

    # Set up for Log Facter 5  

    log4j.appender.SOCKET.layout=org.apache.log4j.PatternLayout  

    log4j.appender.SOCET.layout.ConversionPattern=[start]%d{DATE}[DATE]%n%p[PRIORITY]%n%x[NDC]%n%t[THREAD]%n%c[CATEGORY]%n%m[MESSAGE]%n%n  

    # Log Factor 5 Appender  

    log4j.appender.LF5_APPENDER=org.apache.log4j.lf5.LF5Appender  

    log4j.appender.LF5_APPENDER.MaxNumberOfRecords=2000  

      

    # \u53D1\u9001\u65E5\u5FD7\u7ED9\u90AE\u4EF6  

    log4j.appender.MAIL=org.apache.log4j.net.SMTPAppender  

    log4j.appender.MAIL.Threshold=FATAL  

    log4j.appender.MAIL.BufferSize=10  

    log4j.appender.MAIL.From=yyflyons@163.com  

    log4j.appender.MAIL.SMTPHost=www.wusetu.com  

    log4j.appender.MAIL.Subject=Log4J Message  

    log4j.appender.MAIL.To=yyflyons@126.com  

    log4j.appender.MAIL.layout=org.apache.log4j.PatternLayout  

    log4j.appender.MAIL.layout.ConversionPattern=[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n  


  • jisu_che
    2019-03-01 15:07:43

    说明找不到log4j日志格式配置文件,可能路径读取有误