rollbar-gem icon indicating copy to clipboard operation
rollbar-gem copied to clipboard

Warning about logger and ostruct in Ruby v3.3.5

Open tmimura39 opened this issue 1 year ago • 2 comments

Ruby v3.3.5 was recently released. https://www.ruby-lang.org/en/news/2024/09/03/3-3-5-released/

Warning occurs when loading Rollbar Gem in Ruby v3.3.5

root@6533553801ce:/# cat Gemfile
source "https://rubygems.org"

gem "rollbar"

root@6533553801ce:/# cat main.rb
require "rollbar"

p "RUBY_VERSION #{RUBY_VERSION}"
p "Rollbar::VERSION #{Rollbar::VERSION}"

root@6533553801ce:/# bundle exec ruby main.rb
/usr/local/bundle/gems/rollbar-3.6.0/lib/rollbar.rb:16: warning: logger was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0.
You can add logger to your Gemfile or gemspec to silence this warning.
/usr/local/lib/ruby/3.3.0/json/common.rb:3: warning: ostruct was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0.
You can add ostruct to your Gemfile or gemspec to silence this warning.
"RUBY_VERSION 3.3.5"
"Rollbar::VERSION 3.6.0"

This warning appears to be in preparation for Ruby v3.5 https://github.com/ruby/ruby/pull/10428 https://github.com/ruby/ruby/commit/d7e558e3c48c213d0e8bedca4fb547db55613f7c

You need to add the gem (logger, ostruct) to the rollbar gem's dependencies or stop using the gem in question.

Workaround

Just add them to the Gemfile of each application, as indicated by the warning message

source "https://rubygems.org"

gem "rollbar"
gem "logger"
gem "ostruct"

tmimura39 avatar Sep 05 '24 08:09 tmimura39