i've problem with the deployment of an grails app.
i get the following exception:
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: stacktrace.log (Permission denied)
at java.io.FileOutputStream.openAppend(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:177)
at java.io.FileOutputStream.<init>(FileOutputStream.java:102)
at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
at org.apache.log4j.spi.OptionHandler$activateOptions.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
at org.codehaus.groovy.grails.plugins.logging.Log4jConfig.createFullstackTraceAppender(Log4jConfig.groovy:177)
at org.codehaus.groovy.grails.plugins.logging.Log4jConfig.this$2$createFullstackTraceAppender(Log4jConfig.groovy)
at org.codehaus.groovy.grails.plugins.logging.Log4jConfig$this$2$createFullstackTraceAppender.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:145)
at org.codehaus.groovy.grails.plugins.logging.Log4jConfig.configure(Log4jConfig.groovy:145)
at org.codehaus.groovy.grails.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:62)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
May 25, 2011 11:16:54 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
my settings for the logger in the config look like this:
log4j = {
appenders {
rollingFile name: "stacktrace", maxFileSize: 1024, file: "/var/www/logs/myapp-stacktrace.log"
}
}
i also tried to disable the logger with log4j = { appenders { 'null' name: "stacktrace" } }
the permission for this directory are set for the tomcat-user
-rwxr--r-- 1 tomcat6 root 0 May 24 18:38 myapp-stacktrace.log
no success at all... thanks for any feedback and help!!
I ran into a similar issue with Grails 1.3.7 and found this fixed it (by pushing the stack trace log into the standard logging directory)
log4j = {
appenders {
rollingFile name: "stacktrace", maxFileSize: 1024, file: "/var/logs/piws-stacktrace.log"
....
Check out the official documentation on deploying a Grails application to Tomcat at http://www.grails.org/Deployment/#Tomcat.
To quote the relevant section...
"Be aware that on default settings, Grails will attempt to write to the tomcat directory certain files, typically the stacktrace.log and the h2 database. Your Tomcat directory is likely installed with owner/group of root, while the Tomcat server runs as user tomcat6. This will cause your application to fail to start with write permission errors. Either change your Grails production settings so that these files are written elsewhere to directories with correct permissions OR change the owner of the Tomcat directory (for Unix: /var/lib/tomcat6) to tomcat6 (or whatever tomcat user you set up using the TOMCAT6_USER setting)."
You can use sudo chown tomcat6 /var/lib/tomcat6
to change the owner (replace the user running tomcat and the directory where the logs are being written if needed), which is the simplest and most appropriate solution for most situations.
check disk space (long shot) and try chmodding to 777 just to verify its a permission issue. If it is, you either not running tomcat as the tomcat user or your directories are off...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With