jruby-rack icon indicating copy to clipboard operation
jruby-rack copied to clipboard

Change JrubyRackLogger to Logger

Open jlahtinen opened this issue 1 year ago • 2 comments

I am not sure if Logger is always loaded or not. With rails app it seems it is.

jlahtinen avatar Jun 19 '24 07:06 jlahtinen

I can not say exactly why this initializes Rails.logger in a way it works with requests that has a session management and silence_logger is called.

For some reason silence_logger is not added to JRuby::Rack::Logger but it is added to ::Logger

jlahtinen avatar Jun 19 '24 07:06 jlahtinen

@kares Got a sec to look this over? This was a necessary change to get @jlahtinen's app running with jruby-rack 1.2.x.

headius avatar Jun 20 '24 08:06 headius

So this kind of restores the 1.1 behavior. Which is not the intent here, the idea was to ship with a custom JRuby-Rack logger impl by default. The reason being having better Ruby logging -> Java logging backend integration. Which was not that good in 1.1.x I think e.g. mapping ruby logging level properly to the Java one (would need to look deeper).

For the record, users could use their custom config.logger configuration in Rails, which is respected (and this code won't be used if they set that in Rails).

For some reason silence_logger is not added to JRuby::Rack::Logger but it is added to ::Logger

Would be nice to have a proper fix, the methods missing but required by recent Rails should be added to the JRuby::Rack::Logger impl

kares avatar Aug 08 '24 10:08 kares

Thanks for the update. I try to investigate this further.

jlahtinen avatar Aug 08 '24 11:08 jlahtinen

This problem rose because the usage of activerecord-session_store version that had its own silence_logger implementation. In our case it was activerecord-session_store 1.1.3.

This problem is gone when using latest activerecord-session_store. I think that is ok and this can be closed.

jlahtinen avatar Aug 09 '24 05:08 jlahtinen