log4j:WARN No appenders could be found for logger

在測試JSEL時,調用自定義函數時,出現 異常以下:html

log4j:WARN No appenders could be found for loggerjava

log4j:WARN Please initialize the log4j system properly.apache

解決辦法 參考Joshua Taylor的回答 ,連接以下:app

http://stackoverflow.com/questions/12532339/no-appenders-could-be-found-for-loggerlog4j ide

內容以下:
函數

This Short introduction to log4j guide is a little bit old but still valid.測試

That guide will give you some information about how to use loggers and appenders.ui


Just to get you going you have two simple approaches you can take.this

First one is to just add this line to your main method:spa

BasicConfigurator.configure();

Second approach is to add this standard log4j.properties (taken from the above mentioned guide) file to your classpath:

# Set root logger level to DEBUG and its only appender to A1.log4j.rootLogger=DEBUG, A1# A1 is set to be a ConsoleAppender.log4j.appender.A1=org.apache.log4j.ConsoleAppender# A1 uses PatternLayout.log4j.appender.A1.layout=org.apache.log4j.PatternLayoutlog4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
相關文章
相關標籤/搜索