[Solved] log4j:WARN No appenders could be found for logger

Run the program and report the following warnings:

log4j:WARN No appenders could be found for logger (..).
log4j:WARN Please initialize the log4j system properly.

*Where “..” is the name of a package, such as org.apache.flume.api.abstractrpcclient

Solution:

Add the log4j.properties file in the Src/main/Java/resources directory and add the following:

log4j.rootLogger=debug, stdout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n

Similar Posts: