Q:

Location log4j.properties file in gradle build system

I am able to build my simple java app using log4j2.  However, when I run the app, I get the following error message:
$ gradle run
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:run
ERROR StatusLogger No Log4j 2 configuration file found. Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property 'log4j2.debug' to show Log4j 2 internal initialization logging. See https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions on how to configure Log4j 2

I am using gradle build system.  I put the file - log4j.properties in "src/main/resources/" directory.
$ cat src/main/resources/log4j.properties 

log=/home/aalmehdi/temp/javatut/gradle-demo

# Define the root loogger with appender
log4j.rootlogger=DEBUG, stdout, KPLOGFILE

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c)%n

log4j.appender.KPLOGFILE=org.apache.log4j.FileAppender
log4j.appender.KPLOGFILE.File=${log}/kplog.out
log4j.appender.KPLOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.KPLOGFILE.layout.conversionpattern=%m%n

log4j.logger.kplogger=DEBUG, KPLOGFILE

Can someone please help.
Thank you,
Ahmed.

A:

From configuration documentation:

If a test file cannot be located the properties ConfigurationFactory will look for log4j2.properties on the classpath.

So just rename your configuration file to log4j2.properties.

