Balakrishna
Balakrishna

Reputation: 15

log4j.properties not being picked in Maven based Application

I have searched enough for the below question but could not find the appropriate answer. I would be glad if you can provide me a link if the question already exists.

I am new to Maven and I have created a Maven based application integrated with Hibernate.

Question:

I have a log4j.properties file in "src/java/resources" I have created a Logger instance in one of my classes and tried to print logs however the logs do not get printed on to the console.

Note: I have given the stdout as logs output location.

Upvotes: 0

Views: 331

Answers (1)

Zbynek Vyskovsky - kvr000
Zbynek Vyskovsky - kvr000

Reputation: 18825

src/java/resources/ sounds suspicious. The correct location for classpath resources is src/main/resources/. Put the log4j.properties there.

Additionally, it depends on the version you're using. log4j.properties is no longer supported in newer version. In case you use log4j 2, migrate to log4j2.xml.

Upvotes: 1

Related Questions