Search code examples
tomcatgrailsconfigurationgrails-pluginembedded-tomcat-7

Configuring Logging for Grails Standalone App Runner


I am writing a Grails app and would like to use the Grails Standalone App Runner that packages your Grails app into a fat JAR with an embedded Tomcat container.

I would like to configure logging for the embedded Tomcat container will use to store and read SSL certs from. I want to specify log levels for different catalina components, and also replace log4j with logback using SyslogAppender.

How/where do I make such configurations? Is this documented anywhere?


Solution

  • If you want to replace log4j with logback, you can use Logback Plugin.

    You need to add following lines in your BuildConfig.groovy.

    dependencies {
       compile 'org.grails.plugins:logback:0.3.1'
    }
    

    You also need to exclude grails log4j plugin.

    inherits('global') {
       excludes 'grails-plugin-log4j', 'log4j'
    }
    

    You also need to run

    grails clean
    

    to remove compiled files.

    You can find more about the plugin here.