java - Where should log4j.properties be put in a maven project? src/main/resources not working -


where should place log4j.properties file if don't user propertyconfigurator class , should place log4j.properties file when want use propertyconfigurator class?

when don't use propertyconfigurator, no appenders found logger (logger1) please initialize log4j system properly , 1 other warnings displayed

when use propertyconfigurator, code unable find log4j.properties file when include propertyconfigurator.configure("log4j.properties") in code filenotfound exception being displayed.

i googled issue, despite doing proposed solutions can't still fix it.

here screenshot of maven project structure

maven project structure

i manually added source folder src/main/resources in project , put log4j.properties file there still not working.

here code

package maven.log4jtest;  import org.apache.log4j.logger;  public class test  {  static logger log = logger.getlogger("logger1");  public static void main(string[] args) {     log.info("text message"); } } 


Comments