Skip to content

Instantly share code, notes, and snippets.

@bjensen
Forked from rud/gist:4045605
Created November 19, 2012 21:22
Show Gist options
  • Save bjensen/4114045 to your computer and use it in GitHub Desktop.
Save bjensen/4114045 to your computer and use it in GitHub Desktop.
class ToggleLogging
def self.setup
Signal.trap('USR1') do
toggle
end
end
def self.toggle
level_before = Rails.logger.level == Logger::DEBUG
Rails.logger.level = debug_before ? Logger::INFO : Logger::DEBUG
Rails.logger.info "USR1 signal received, log level is now #{Rails.logger.level}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment