Rails Logging

I am trying to get logging under control in my rails app when running
locally. I have a jar that has a lot of functionality that calls
external
services, interacts with databases, etc. I would like to be able to set
the
log levels in the dev environment to something different in prod. My
rails
logging works fine, but I am unable to change to log level in the java
classes from anything but INFO. I have tried adding an initializer to
set
the level to FINE but it doesn’t have any effect. Any help would be
appreciated.

java::util::logging::Logger.getLogger("").setLevel(java::util::logging::Level::FINE)

On Thu, Sep 1, 2011 at 3:26 PM, Eric F. [email protected] wrote:
[…snip…]

classes from anything but INFO. I have tried adding an initializer to set
the level to FINE but it doesn’t have any effect. Any help would be
appreciated.

java::util::logging::Logger.getLogger(“”).setLevel(java::util::logging::Level::FINE)

Are you certain that the jar is using the java.util.logging API, and
not one of the myriad other Java logging options?

Assuming it is using JUL, try the following to update all currently
registered loggers:

import ‘java.util.logging.LogManager’
import ‘java.util.logging.Level’

lm = LogManager.log_manager
lm.logger_names.each do |name|
lm.get_logger(name).level = Level::FINE
end

On Thu, Sep 1, 2011 at 3:43 PM, Anthony J. [email protected]
wrote:

Assuming it is using JUL, try the following to update all currently
registered loggers:

import ‘java.util.logging.LogManager’
import ‘java.util.logging.Level’

lm = LogManager.log_manager
lm.logger_names.each do |name|
lm.get_logger(name).level = Level::FINE
end

Forgot to mention that you may want to update the associated handlers
too (since they can also filter out messages):

import ‘java.util.logging.LogManager’
import ‘java.util.logging.Level’

lm = LogManager.log_manager
lm.logger_names.each do |name|
l = lm.get_logger(name)
l.level = Level::FINE
l.handlers.each do |h|
h.level = Level::FINE
end
end