When you want to change the output destination of the log according to the directory where the application is expanded, etc.
https://www.mkyong.com/gradle/gradle-application-plugin-app_home-in-applicationdefaultjvmargs/
The above manma. But isn't it too small?
build.gradle
applicationDefaultJvmArgs = [ "-DappHome=MY_APP_HOME" ]
startScripts {
doLast {
unixScript.text = unixScript.text.replace('MY_APP_HOME', '\$APP_HOME')
}
}
logback.xml
<appender name="APPLOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${appHome}/logs/app.log</file>
~(The following is omitted)
Recommended Posts