zoukankan      html  css  js  c++  java
  • log4j:WARN Please initialize the log4j system properly解决办法

    使用log4j,报警如下:

    log4j:WARN No appenders could be found for logger

    log4j:WARN Please initialize the log4j system properly.

    maven项目,在项目下建source folder “/src/test/resources”;

    在上面路径下建一个文件log4j.properties;

    将如下内容复制到log4j.properties

    # For Testing Guys
    # Set root logger level to error log4j.rootLogger
    =INFO, Console ###### Console appender definition ####### # All outputs currently set to be a ConsoleAppender. log4j.appender.Console=org.apache.log4j.ConsoleAppender log4j.appender.Console.layout=org.apache.log4j.PatternLayout log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{3}] %m%n #log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n ###### File appender definition ####### log4j.appender.File=org.apache.log4j.DailyRollingFileAppender log4j.appender.File.File=spring.log log4j.appender.File.Append=false log4j.appender.File.layout=org.apache.log4j.PatternLayout log4j.appender.File.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n
    log4j.rootLogger=debug, stdout, R
    
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    
    log4j.appender.stdout.layout.ConversionPattern=%5p - %m%n
    
    log4j.appender.R=org.apache.log4j.RollingFileAppender
    log4j.appender.R.File=firestorm.log
    
    log4j.appender.R.MaxFileSize=100KB
    log4j.appender.R.MaxBackupIndex=1
    
    log4j.appender.R.layout=org.apache.log4j.PatternLayout
    log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
    
    log4j.logger.com.codefutures=DEBUG
  • 相关阅读:
    stm32之PWM博客好文收藏
    CSDN怎么转载别人的博客
    STM32F103单片机学习—— 通用定时器
    STM32 通用定时器好文章收藏
    stm32基本定时器timer6的原理与使用
    freertos优秀博客收藏
    StretchBlt函数和BitBlt函数的用法
    对话框添加背景图片
    vc 使窗口置顶 在最前面
    CWnd::MoveWindow 详解
  • 原文地址:https://www.cnblogs.com/meiling-ji/p/9706783.html
Copyright © 2011-2022 走看看