trinidad/trinidad — Issue #50: undefined method `log' for nil:NilClass
Author: jingweno
Created: 2012-01-30 23:21:38+00:00
State: open

Hi,

I have a sinatra app and try to log some messages in the controller, here is some sample code:

```ruby
get '/foo' do
logger.info('foo')
end
```

And here is the exception I got from the stacktrace. Do I miss anything on piping sinatra's logger to trinidad? I found a trinidad plugin here and wondering I need to add it to the stack (https://github.com/trinidad/trinidad_logging_extension).

```bash
Error: Couldn't handle error: response committed
org.jruby.exceptions.RaiseException: (NoMethodError) undefined method `log' for nil:NilClass
at JRuby::Rack::ServletLog.write(file:/Users/oou/.rvm/gems/jruby-1.6.6/gems/jruby-rack-1.1.3/lib/jruby-rack-1.1.3.jar!/jruby/rack/servlet_log.rb:18)
at Rack::CommonLogger.log(/Users/oou/.rvm/gems/jruby-1.6.6/gems/rack-1.4.1/lib/rack/commonlogger.rb:39)
at Rack::CommonLogger.call(/Users/oou/.rvm/gems/jruby-1.6.6/gems/rack-1.4.1/lib/rack/commonlogger.rb:22)
at org.jruby.RubyProc.call(org/jruby/RubyProc.java:258)
at Rack::BodyProxy.close(/Users/oou/.rvm/gems/jruby-1.6.6/gems/rack-1.4.1/lib/rack/body_proxy.rb:17)
at JRuby::Rack::Response.write_body(file:/Users/oou/.rvm/gems/jruby-1.6.6/gems/jruby-rack-1.1.3/lib/jruby-rack-1.1.3.jar!/jruby/rack/response.rb:111)
at JRuby::Rack::Response.respond(file:/Users/oou/.rvm/gems/jruby-1.6.6/gems/jruby-rack-1.1.3/lib/jruby-rack-1.1.3.jar!/jruby/rack/response.rb:50)
Error: Couldn't handle error: response committed
org.jruby.exceptions.RaiseException: (NoMethodError) undefined method `log' for nil:NilClass
at JRuby::Rack::ServletLog.write(file:/Users/oou/.rvm/gems/jruby-1.6.6/gems/jruby-rack-1.1.3/lib/jruby-rack-1.1.3.jar!/jruby/rack/servlet_log.rb:18)
at Rack::CommonLogger.log(/Users/oou/.rvm/gems/jruby-1.6.6/gems/rack-1.4.1/lib/rack/commonlogger.rb:39)
at Rack::CommonLogger.call(/Users/oou/.rvm/gems/jruby-1.6.6/gems/rack-1.4.1/lib/rack/commonlogger.rb:22)
at org.jruby.RubyProc.call(org/jruby/RubyProc.java:258)
at Rack::BodyProxy.close(/Users/oou/.rvm/gems/jruby-1.6.6/gems/rack-1.4.1/lib/rack/body_proxy.rb:17)
at JRuby::Rack::Response.write_body(file:/Users/oou/.rvm/gems/jruby-1.6.6/gems/jruby-rack-1.1.3/lib/jruby-rack-1.1.3.jar!/jruby/rack/response.rb:111)
at JRuby::Rack::Response.respond(file:/Users/oou/.rvm/gems/jruby-1.6.6/gems/jruby-rack-1.1.3/lib/jruby-rack-1.1.3.jar!/jruby/rack/response.rb:50)
```

Thanks,
Owen