问题描述
我在部署grails应用时遇到了问题。
我收到以下异常:
log4j:错误setFile(null,true)调用失败。
java.io.FileNotFoundException:stacktrace.log(Permission denied)
at java.io.FileOutputStream.openAppend(Native Method)
at java.io.FileOutputStream。< init>(FileOutputStream .java:177)
在java.io.FileOutputStream。< init>(FileOutputStream.java:102)
at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
在org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
在org.apache.log4j.spi.OptionHandler $ activateOptions.call(未知来源)
在org.codehaus。 groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
在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.Log4j Config.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 .org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
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)
在org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
在org.apache。 catalina.core.StandardEngine.start(StandardEngine.java:445)
在org.apache.catalina.core.StandardService.start(StandardService.java:519)
在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。在org.apache.catalina.startup.Bootstrap.main中调用(Method.java:597)
在org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
(Bootstrap。 java:414)
2011年5月25日下午11:16:54 org.apache.catalina.core .ApplicationContext log
INFO:初始化Spring根WebApplicationContext
我的配置中的记录器设置看起来像这样:
log4j = {
appenders {
rollingFile name:stacktrace,maxFileSize: 1024,file:/var/www/logs/myapp-stacktrace.log
}
}
我也尝试用
log4j = {
appenders {
'null'name:stacktrace
}
}禁用记录器。
这个目录的权限是为tomcat-user设置的
$ p $ -rwxr - r-- 1 tomcat6 root 0 May 24 18:38 myapp-stacktrace.log
没有成功......感谢任何反馈和帮助!!
我遇到了与Grails 1.3类似的问题.7,并发现这可以修复它(通过将堆栈跟踪日志推入标准日志记录目录)
log4j = {
appenders {
rollingFile name:stacktrace,maxFileSize:1024,file :/var/logs/piws-stacktrace.log
....
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"
....
这篇关于stacktrace.log在部署grails应用程序时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!