Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to initialize Rack::CommonLogger #3117

Closed
ninoseki opened this issue Apr 1, 2023 · 0 comments · Fixed by #3118
Closed

Failed to initialize Rack::CommonLogger #3117

ninoseki opened this issue Apr 1, 2023 · 0 comments · Fixed by #3118
Labels

Comments

@ninoseki
Copy link
Contributor

ninoseki commented Apr 1, 2023

Describe the bug

Rack::CommonLogger is failed to initialize because of NameError if Verbose is set as true with:

  • puma v6.2.1
  • rack v3.0.7
  • rackup v2.1.0

Puma config:

Please see the following section.

To Reproduce

# test.rb

require "rack"
require "rackup"
require "rack/handler/puma"

class App
  def initialize
    @rack_static = Rack::Static.new(
      -> { [404, {}, []] },
      root: File.expand_path("./", __dir__),
      urls: ["/"]
    )
  end

  def call(env)
    @rack_static.call(env)
  end
end

app = Rack::Builder.new do
  run App.new
end.to_app

Rackup::Handler::Puma.run(app, Verbose: true)
$ ruby test.rb
/Users/foo/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/puma-6.2.1/lib/rack/handler/puma.rb:35:in `block in config': uninitialized constant Puma::Rack::CommonLogger (NameError)

          app = Rack::CommonLogger.new(app, STDOUT)
                    ^^^^^^^^^^^^^^
        from /Users/foo/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/puma-6.2.1/lib/puma/configuration.rb:195:in `configure'
        from /Users/foo/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/puma-6.2.1/lib/puma/configuration.rb:188:in `initialize'
        from /Users/foo/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/puma-6.2.1/lib/rack/handler/puma.rb:32:in `new'
        from /Users/foo/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/puma-6.2.1/lib/rack/handler/puma.rb:32:in `config'
        from /Users/foo/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/puma-6.2.1/lib/rack/handler/puma.rb:64:in `run'
        from test.rb:25:in `<main>'

Expected behavior

Rack::CommonLogger is initialized without NameError.

Desktop (please complete the following information):

  • OS: Mac
  • Puma Version: 6.2.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants