title: Grails: log stacktrace to stdout
body: <p>When I launch my grails application, I get the following error:</p>
  
  <blockquote>
    <p>java.io.FileNotFoundException: stacktrace.log (Permission denied)</p>
  </blockquote>
  
  <p>I know this can be solved by chowning some files/directories or by changing the file the logs go to, but I don't want this: I just want stracktraces to be logged to the stdout.</p>
  
  <p>The <a href="http://grails.org/doc/2.1.0/guide/conf.html" rel="nofollow">documentation</a> states:</p>
  
  <blockquote>
    <p>For example if you prefer full stack traces to go to the console, add
    this entry:</p>
    
    <p>error stdout: "StackTrace"</p>
  </blockquote>
  
  <p>However: it also states: </p>
  
  <blockquote>
    <p>This won't stop Grails from attempting to create the stacktrace.log
    file - it just redirects where stack traces are written to.</p>
  </blockquote>
  
  <p>And later:</p>
  
  <blockquote>
    <p>or, if you don't want to the 'stacktrace' appender at all, configure
    it as a 'null' appender:</p>
  </blockquote>
  
  <pre><code>log4j = {
      appenders {
          'null' name: "stacktrace"
      }
  }
  </code></pre>
  
  <p>I combine the 2 and get the following configuration:</p>
  
  <pre><code>// log4j configuration
  environments {
      production {
          log4j = {
              appenders {
                  console name:'stdout', layout:pattern(conversionPattern: '%c{2} %m%n')
                  // Don't use stacktrace.log
                  'null' name: "stacktrace"
              }
          }
  
      }
  }
  
  log4j = {
      // print the stacktrace to stdout
      error stdout:"StackTrace"
  }
  </code></pre>
  
  <p>Unfortunately, this doesn't work:</p>
  
  <blockquote>
    <p>INFO: Deploying web application archive MyBackend.war</p>
    
    <p>Sep 12, 2012 4:46:11 PM org.apache.catalina.core.StandardContext start</p>
    
    <p>SEVERE: Error listenerStart</p>
    
    <p>Sep 12, 2012 4:46:11 PM org.apache.catalina.core.StandardContext start</p>
    
    <p>SEVERE: Context [/MyBackend2] startup failed due to previous errors</p>
  </blockquote>
  
  <p>Admittedly, it doesn't attempt to write stacktrace.log anymore, so the Permission denied error isn't thrown anymore, but I have no clue why the app won't start becaue the only thing it logs is "Error listenerStart"</p>
  
  <p>Can anyone please help me with configuring my app to just log the stacktraces to stdout?</p>