-
Notifications
You must be signed in to change notification settings - Fork 5
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
Silently fallback to WEBrick or panic: failed to coerce org.slf4j.helpers.NOPLoggerFactory to ch.qos.logback.core.Context #20
Comments
Further: mizuno works fine both with rackup command or mizuno command directly. |
I don't think mizuno sets up logging in any similar way. I can't reproduce this, yet. I upgraded to jruby 9.1.17. My best guess is that somewhere your are loading an incompatible version of SLF4J jar prior to fishwife trying to load rjack-logback gem and rjack-slf4j (packaging its own version of that jar.) There may have been later releases of these that are incompatible with, ahead of the rjack-logback/slf4j versions? Does your loading jruby-jars end up doing that? Why do you need that? |
Please provide a minimal, self contained, reproducible case. For example, you could start with the fishwife (source tree) example/config.ru and modify until it fails in the same way. |
@dekellum Gemfile: source 'https://rubygems.org'
gem 'cuba'
gem 'fishwife', :platforms => :jruby
gem 'rjack-logback', :platforms => :jruby config.ru: require 'bundler/setup'
Bundler.require(:default)
if defined?(Fishwife) && defined?(RJack::Logback)
RJack::Logback.config_console( :stderr => true, :thread => true )
end
Cuba.define do
on root do
res.write '<h1>Hello, world!</h1>'
end
end
run Cuba Generated Gemfile.lock with bundler:
Behavior:
If I remove
stone$ rackup -s Fishwife
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Environment: bogon: ~/tmp/fishwife.test ]
stone$ jruby -v
jruby 9.1.17.0 (2.3.3) 2018-04-20 d8b1ff9 Java HotSpot(TM) 64-Bit Server VM 25.131-b11 on 1.8.0_131-b11 +jit [darwin-x86_64]
bogon: ~/tmp/fishwife.test ]
stone$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
bogon: ~/tmp/fishwife.test ]
stone$ @ macOS 10.12.6 |
When you say "freezes", is your server just running but without console logging (given logging setup failed)? In your original report:
Isn't reproduced in your minimized case? I'm not familiar with cuba gem, can your factor that out as well, and still repro (e.g. simple rack app)? Also you might try |
I tested again with dead simple Gemfile/config.ru, and the result is exactly same as in my previous post, while I do found a mistake I wrote. When I said 'freeze', the server actually worked, I was misled because every other rack handler will report the ip-address and/or port it listens on, while fishwife doesn't output anything like that. I'll repeat the result here for clear reading, and with additional test result of
Gemfile: source 'https://rubygems.org'
gem 'fishwife', :platforms => :jruby
gem 'rjack-logback', :platforms => :jruby config.ru require 'bundler/setup'
Bundler.require(:default)
if defined?(Fishwife) && defined?(RJack::Logback)
RJack::Logback.config_console( :stderr => true, :thread => true )
end
run proc { |env| [200, {}, ['<h1>hello, world!</h1>'] ] } Gemfile.lock (produced with gem 'rjack-logback')
Gemfile.lock (without gem 'rjack-logback')
|
OK, I'm able to reproduce both of the two issues you are seeing. Firstly regarding WEBrick being run from the #\ -s Fishwife Alternatively if you add a dependency for rack Regarding the other logging initialization issue when using if RUBY_PLATFORM =~ /java/
require 'rjack-logback'
RJack::Logback.config_console( :stderr => true, :thread => true )
end
run proc { |env| [200, {}, ['<h1>hello, world!</h1>'] ] } This works with So there are workarounds for both issues and some potential fixes can be made to make it harder to encounter these in the first place. |
Previously this was relying on in-place mutation which is no longer supported in rack 2.0 github: #20
ffcfe5c fixes the need for |
confirmed. thank u very much. |
released to rubygems as fishwife 1.10.1 |
rackup -s Fishwife
causes load exception:While simple run
fishwife
, the app starts with rack default handler WEBrick:jruby 9.1.7.0 @ macos 10.12.6
stone$ java -version java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
config.ru:
Gemfile:
Gemfile.lock:
If I remove 'gem rjack-logback' from Gemfile, and remove
RJack::Logback.config_console( :stderr => true, :thread => true )
call from config.ru, then rackup command will freeze on loading.In this case, use
fishwife
instead, app runs with rack handler fallback to WEBrick, simply the same case with gem rjack-logback included with Gemfile.The text was updated successfully, but these errors were encountered: