daemons-rails icon indicating copy to clipboard operation
daemons-rails copied to clipboard

Error on stop: cannot load such file -- daemons/rails/config (LoadError)

Open russkuhn opened this issue 12 years ago • 2 comments

Just installed this gem and I love what it does. Thank you for creating it. Using just the simple_daemon created by your generator, when I start the daemon everything is fine, logging every 10 seconds. But when I stop it (./lib/daemons/simple_daemon_ctl stop), it creates the log file log/simple_daemon.rb.log containing the errors:

# Logfile created on 2013-08-26 16:50:35 -0400 by logger.rb/36483
I, [2013-08-26T16:50:35.353122 #41824]  INFO -- : *** below you find the most recent exception thrown, this will be likely (but not certainly) the exception that made the application exit abnormally ***
E, [2013-08-26T16:50:35.353364 #41824] ERROR -- : cannot load such file -- daemons/rails/config (LoadError)
/Users/russ/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in `require'
/Users/russ/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in `require'
./lib/daemons/simple_daemon_ctl:3:in `<main>'
I, [2013-08-26T16:50:35.353531 #41824]  INFO -- : *** 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 ***
E, [2013-08-26T16:50:35.354616 #41824] ERROR -- : stream closed (IOError)
E, [2013-08-26T16:50:35.354806 #41824] ERROR -- : failed to allocate memory (NoMemoryError)
E, [2013-08-26T16:50:35.354926 #41824] ERROR -- : stack level too deep (SystemStackError)
E, [2013-08-26T16:50:35.355246 #41824] ERROR -- : exception reentered (#<Class:0x007fbfe40e0758>)    
E, [2013-08-26T16:50:35.369170 #41824] ERROR -- : cannot load such file -- daemons/rails/config (LoadError)
/Users/russ/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in `require'
/Users/russ/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in `require'
./lib/daemons/simple_daemon_ctl:3:in `<main>'

The only change I made to the generated code was commenting out Rails.logger.auto_flushing = true because I use log4r. Everything seems to work, but it would be better not to have errors in the log file.

I'm using rvm, ruby 2.0.0p247, and Rails 4.0.0.

-Russ

russkuhn avatar Aug 26 '13 21:08 russkuhn

Solution1

Exec touch log/simple_daemon.rb.log before Daemons::Rails.run config[:script], config.to_hash.

Solution2

Set config[:logfilename] = "#{ENV['RAILS_ENV'] || 'development'}.log" before Daemons::Rails.run config[:script], config.to_hash.

ppworks avatar Jun 29 '15 08:06 ppworks

had same issues. This solved my problem :D Thank you very much

bogdanRada avatar Jan 06 '16 15:01 bogdanRada