Play plugin + Play 2.3 logger configuration in dev mode ignored: solution (at least temporary)


(Yaroslav Mudryy) #1

Hi everybody,

We are migrating some of our Play projects from SBT to Gradle. Just like some other people, we had an issue making custom logger.xml being used for logger config when running with runPlayBinary. Since we’re on Play 2.3, there seems to be no option of extending ApplicationLoader.

We’ve noticed that when SBT compiles same project to run in dev mode, it does not package/copy the logger.xml anywhere in the ‘target’ directory, so guessed that it uses the original logger.xml from the source code directory. Therefore, maybe it’s a hack, but the following worked for us in Gradle to make logger work with custom config:

tasks.withType(PlayRun) {
     forkOptions.jvmArgs = ["-Dlogger.file=${projectDir}/conf/logger.xml"]
}

Hopefully it will save time for someone.