#89 ✓resolved
Jerome Gagner

Rack::Logger always raises exception

Reported by Jerome Gagner | January 29th, 2010 @ 07:02 PM

When attempting to use Rack::Logger the following exception occurs:


Rack::Lint::LintError: rack.errors#close must not be called
    /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:18:in `assert'
    /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:417:in `close'
    /opt/local/lib/ruby/1.8/logger.rb:510:in `close'
    /opt/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
    /opt/local/lib/ruby/1.8/logger.rb:509:in `close'
    /opt/local/lib/ruby/1.8/logger.rb:418:in `close'
    /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/logger.rb:17:in `call'
    /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:47:in `_call'
    /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:35:in `call'
    /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/showexceptions.rb:24:in `call'
    /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/commonlogger.rb:18:in `call'
    /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb:13:in `call'
    /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/chunked.rb:15:in `call'
    /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:67:in `process'
    /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
    /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
    /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
    /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
    /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
    /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
    /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
    /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
    /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
    /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
    /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:38:in `run'
    /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:155:in `start'
    /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:83:in `start'
    /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/bin/rackup:4
    /opt/local/bin/rackup:19:in `load'
    /opt/local/bin/rackup:19

You can reproduce with the following config.ru (modified from test/spec_rack_logger.rb)

app = lambda { |env|
      log = env['rack.logger']
      log.debug("Created logger")
      log.info("Program started")
      log.warn("Nothing to do!")

      [200, {'Content-Type' => 'text/plain'}, ["Hello, World!"]]
    }

   run  Rack::Logger.new(app)

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Pages