Configure log4j.properties in Intellij

Viewed 30049

I have problem configure log4j properties.
I used to use code to configure logger.
But, now I am getting the no appenders could be found WARN from groovyx.net.http.RESTClient which I can't change the code. The WARN is below:

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

So I tried to use the log4j.properties file by default to setup the appenders. But, I don't know where I should put the log4j.properties file. I add the -Dlog4j.debug as JVM option and run the test. I am getting the below information:

log4j: Trying to find [log4j.xml] using context classloader sun.misc.Launcher$AppClassLoader@a6eb38a.
log4j: Trying to find [log4j.xml] using sun.misc.Launcher$AppClassLoader@a6eb38a class loader.  
log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
log4j: Trying to find [log4j.properties] using context classloader sun.misc.Launcher$AppClassLoader@a6eb38a.
log4j: Trying to find [log4j.properties] using sun.misc.Launcher$AppClassLoader@a6eb38a class loader.
log4j: Trying to find [log4j.properties] using ClassLoader.getSystemResource().
log4j: Could not find resource: [null].  

I am using IntelliJ and running a Spock test. Any answer will be appreciate. Thank you.

2 Answers
Related