Akin Dönmez
Akin Dönmez

Reputation: 363

Log4j properties giving error

I m getting the error message

log4j:WARN No appenders could be found for logger (com.faktorZehn.socialNetwork.socialNetwork.PersonGenerator).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

enter image description here

my properties looks like

 This sets the global logging level and specifies the appenders
log4j.rootLogger=INFO, theConsoleAppender

# settings for the console appender
log4j.appender.theConsoleAppender=org.apache.log4j.ConsoleAppender
log4j.appender.theConsoleAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.theConsoleAppender.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

any ides where do i do wrong ?

Upvotes: 1

Views: 148

Answers (2)

Fatih Donmez
Fatih Donmez

Reputation: 4347

Be sure that log4j.properties is in the classpath. Make the resources folder actually a resource folder. It looks like a maven project so you can move it to src/main/resources

Alternatively you can set it with JVM argument.

-Dlog4j.configuration=resources/log4j.properties

Upvotes: 1

czpona
czpona

Reputation: 320

your resources folder is not on your classpath. Right click on the folder -> Build Path -> Use as source folder.

Then rerun your app and your log4j.properties should be used by log4j framework.

Upvotes: 3

Related Questions