Forum: Rails Engines How to set logging level for Rails Engines

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Eb0fe7baa14714f958522ed7c13f1ba6?d=identicon&s=25 Franck Y. (franck33)
on 2008-05-05 09:40
Hello,

I get "Checking plugin..." all the time in the log and would like to
disable it. I figure out that it comes from Engines.logger and want to
set the logging level to info in stead of debug. How can I do this?
Thaks!


Franck
7ef9dc5e11b6e49bfc05c24f855ca0af?d=identicon&s=25 Chris L. (cglee)
on 2008-07-29 00:28
To minimize engines polluting our logs, we just changed the logger for
the engines plugin like this:

In engines.rb, update the logger method:

    def logger
      #RAILS_DEFAULT_LOGGER
      Logger.new(RAILS_ROOT + "/log/engines.log")
    end

And then create an "engines.log" under your /log directory.  Now all
engines related logging will be directed to that file instead of your
development.log.
7ef9dc5e11b6e49bfc05c24f855ca0af?d=identicon&s=25 Chris L. (cglee)
on 2008-07-29 01:01
Probably better to do this:

  Logger.new(File.join(RAILS_ROOT, "log", "engines.log"))
00f3581646583086a1a1c7828207e46f?d=identicon&s=25 Wins L. (zvooq)
on 2013-06-14 10:05
Chris Lee wrote in post #708133:
> In engines.rb, update the logger method:
>
>     def logger
>       #RAILS_DEFAULT_LOGGER
>       Logger.new(RAILS_ROOT + "/log/engines.log")
>     end

But how to use it then? Wouldn't it instantiate a new Logger instance
every
time I call it?

def some_foo_method
  # I want to log something, I call the logger method
  logger.debug("I did something")
end

So, the "logger" method instantiates a new Logger instance every time.
It is not good to have dozens logger instances in memory. How to avoid
it? How to instantiate once and then just take only that one instance?
F309368ae86176f775182187c0af3c58?d=identicon&s=25 Tap C. (tapchi18plus)
on 2014-05-18 19:07
I get "Checking plugin..." all the time in the log and would like to
disable it. I figure out that it comes from Engines.logger and want to
set the logging level to info in stead of debug. How can I do this?
Thaks!
This topic is locked and can not be replied to.