[英]Location log4j.properties file in gradle build system
我可以使用log4j2構建我的簡單java應用程序。 但是,當我運行該應用程序時,我收到以下錯誤消息:
$ gradle run
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:run
ERROR StatusLogger No Log4j 2 configuration file found. Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property 'log4j2.debug' to show Log4j 2 internal initialization logging. See https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions on how to configure Log4j 2
我正在使用gradle構建系統。 我把文件--log4j.properties放在“src / main / resources /”目錄中。
$ cat src/main/resources/log4j.properties
log=/home/aalmehdi/temp/javatut/gradle-demo
# Define the root loogger with appender
log4j.rootlogger=DEBUG, stdout, KPLOGFILE
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c)%n
log4j.appender.KPLOGFILE=org.apache.log4j.FileAppender
log4j.appender.KPLOGFILE.File=${log}/kplog.out
log4j.appender.KPLOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.KPLOGFILE.layout.conversionpattern=%m%n
log4j.logger.kplogger=DEBUG, KPLOGFILE
有人可以請幫助。
艾哈邁德,謝謝你。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.