How to externalize logback configuration
Grails 3 is built on top of springboot and takes advantage of springboot's logging system. So springboots logging related configuration properties mentioned here can be used with Grails too.
Below is an example of how to use external logback configuration file, this applies to springboot too.
Specify the logback configuration file using logging.config
Spring boot uses the value of configuration
logging.config to configure the logging system.
logging.config accepts a spring resource pattern.
If we wanted to use a different logback configuration for production environment, it can be configured as below.
File: application.yml (or application.groovy)
environments: production: logging: #Logback config for production config: classpath:logback-prod.groovy
Below is an example of how to load the configuration from file system.
environments: production: logging: #Logback config for production config:file:/<path-to-logback-config.groovy>
The example above uses a groovy configuration file. However logback xml configuration will work too.