Closed tonivdv closed 12 years ago
Hmm, I just see in the stack that it uses ruby 1.8.7 :s ... although I installed 1.9.x ...
It's still early so I suppose I'm not yet waken :-/
Sorry 'bout that
Now I installed (I think) everything correctly, but I get same stacktrace :s
[2012-09-25 09:16:03] INFO WEBrick 1.3.1
[2012-09-25 09:16:03] INFO ruby 1.9.3 (2012-04-20) [i686-linux]
[2012-09-25 09:16:03] INFO WEBrick::HTTPServer#start: pid=18617 port=9292
10.0.0.51 - - [25/Sep/2012 09:16:23] "GET / HTTP/1.1" 404 435 0.0352
[2012-09-25 09:16:23] ERROR NoMethodError: undefined method `write' for #<Logger:0xaec2d90>
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/commonlogger.rb:33:in `log'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/commonlogger.rb:22:in `block in call'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/body_proxy.rb:17:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/body_proxy.rb:17:in `close'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/lint.rb:555:in `close'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/body_proxy.rb:15:in `close'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/handler/webrick.rb:75:in `service'
/usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/usr/local/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
10.0.0.51 - - [25/Sep/2012 09:16:28] "GET /favicon.ico HTTP/1.1" 404 446 0.0010
[2012-09-25 09:16:28] ERROR NoMethodError: undefined method `write' for #<Logger:0xaec2d90>
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/commonlogger.rb:33:in `log'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/commonlogger.rb:22:in `block in call'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/body_proxy.rb:17:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/body_proxy.rb:17:in `close'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/lint.rb:555:in `close'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/body_proxy.rb:15:in `close'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/handler/webrick.rb:75:in `service'
/usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/usr/local/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
There is a real issue here, and I already experienced it with different ruby versions (> 1.9.0). Here is my patch:
diff --git a/config/boot.rb b/config/boot.rb
index cbc1e5e..036429e 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -15,5 +15,6 @@ Rabl.register!
require 'application'
require 'logger'
-$logger = Logger.new('log/application.log')
+class ::Logger; alias_method :write, :<<; end
+$logger = ::Logger.new('log/application.log')
use Rack::CommonLogger, $logger
I extended the Logger
class to handle the write
method:
class ::Logger; alias_method :write, :<<; end
$logger = ::Logger.new('log/application.log')
It seems to be a common error with Sinatra applications, see: http://stackoverflow.com/questions/2239240/use-rackcommonlogger-in-sinatra.
@sethvargo your input on that? Thank you.
I confirm that @willdurand fix/hack does the trick. thx.
@willdurand Can you submit a PR?
Fixed in 74a111fdc6816c347cad56b31b26788170e7991d
Hi,
I got following stacktrace when trying to run the server:
Any ideas what it could be?
Ruby = 1.9.1
RubyGems = 1.8.24
cheers