【发布时间】:2014-07-24 05:06:00
【问题描述】:
除了 daemon_generator 插件之外,我还在使用带有 Rails 的 daemons gem。我在守护进程日志文件中得到了这个输出:
Logfile created on Sat May 09 20:10:35 -0700 2009 by /
-below you find the most recent exception thrown, this will be likely (but not certainly) the exception that made the application exit abnormally ***
#<NameError: uninitialized constant SmsMessage>
-below you find all exception objects found in memory, some of them may have been thrown in your application, others may just be in memory because they are standard exceptions ***
#<NoMemoryError: failed to allocate memory>
#<SystemStackError: stack level too deep>
#<fatal: exception reentered>
#<MissingSourceFile: no such file to load -- ./config/global_constants.conf>
#<NameError: uninitialized constant SmsMessage>
我发现这个输出很难理解。它显示不同的错误消息,我可以说这不是 ./config/global_constants.conf 问题,因为我没有在守护程序文件中调用它。另外,我认为这不是内存问题,因为我的 Mac 有 2GB 内存并且运行的程序不多。至于我通常使用的 SmsMessage 调用它:
scheduledMessagesParent = SmsMessage.valid.find(:all, :conditions => {:status => $SCHEDULED_MESSAGE})
在我网站的其他地方也可以使用!! 我注意到记录器是使用
调用的ActiveRecord::Base.logger.info "....
是否有可能我必须以其他方式指定模型的路径?我通常使用 logger.info 调用记录器,而不需要 ActiveRecord::Base。如果有怎么办?
任何想法如何去调试这个问题?有没有办法显示堆栈跟踪或更好的错误消息?
【问题讨论】:
标签: ruby-on-rails ruby-daemons