Skip to content

Instantly share code, notes, and snippets.

@rud
Created November 9, 2012 13:13
Show Gist options
  • Save rud/4045605 to your computer and use it in GitHub Desktop.
Save rud/4045605 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