TwP / logging

A flexible logging library for use in Ruby programs based on the design of Java's log4j library.
https://rubygems.org/gems/logging
MIT License
529 stars 100 forks source link

Add formatter= method to make the logging gem compatible with rails 7.1 #246

Closed ag4ta closed 3 months ago

ag4ta commented 10 months ago

Hi,

Following the convention to make the logging gem compatible with Rails versions I added empty formatter=(_formatter) method.

This PR is my attempt to solve the issue #245

As I investigated Rails 7.1 introduces some changes in Rails logger and when someone upgrades their Rails they get the error:

NoMethodError: undefined method `formatter='

Here is the link to Rails guide with details.

@TwP could you please take a look at this PR? I would be very happy if this is proper way to solve the issue and if it would be merged 😊

Resolves issue: #245

juna-nb commented 5 months ago

Confirming this also fixes the issue for me using Rails 7.1 and Ruby 3.3. I was getting the error while trying to use https://github.com/zormandi/logcraft/issues/5#issuecomment-1941789296. Thanks for the fix @ag4ta, looks like I might need to use a fork of your version until they can push an update.

mhenrixon commented 3 months ago

Thank you for the pull request - apologies for taking so long to get around to pulling this into the main branch.

OSS is hard at times, no hard feelings.