问题
I'm trying to externalize my logback.groovy
file by setting the path in my build.gradle
file in the bootrun closure:
bootRun {
if (Environment.currentEnvironment == Environment.PRODUCTION) {
jvmArgs = ['-XX:MaxPermSize=2g', '-Xmx2g', '-Dlogging.config=/path/to/config/logback.groovy']
} else {
jvmArgs = ['-XX:MaxPermSize=2g', '-Xmx2g']
}
}
But I am getting:
.logback.classic.LoggerContext[default] - Found resource [logback.groovy] at [file:/Users/name/workspace/project/build/resources/main/logback.groovy]
It keeps reading from the classpath and not from the external file... Any help appreciated, thanks
回答1:
I fixed the issue by adding -Dlogging.config=/path/to/config/logback.groovy
as a system property in tomcat.
来源:https://stackoverflow.com/questions/38853935/grails-3-external-logback-groovy-file