config.logger level is overwritten

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

config.logger level is overwritten

Morteza Milani
Hello all,

I have a comment about rails logger and I wish to change its behaviour.

Rails tries to load the logger from config like this:

Rails.logger ||= config.logger || begin
logger =

Then later after the above block, it sets the logger level:

Rails.logger.level = ActiveSupport::Logger.const_get(config.log_level.to_s.upcase)

The problem is that this overwrites the level that is set in the config.logger. In normal cases, it is no problem. But when different logging classes are embedded
and they depend on the log level, this makes a problem since the final value of the logger will be different from the value set in the config.logger.

Moreover, it is more intuitive to expect the logging level set on the object provided rather than config.log_level.

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit