Created
November 22, 2011 01:56
-
-
Save tyabe/1384664 to your computer and use it in GitHub Desktop.
Rubyスクリプトが落ちた場合にログを取得する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# coding: utf-8 | |
require 'logger' | |
logger = Logger.new(STDOUT) | |
# 予期しない例外等での終了を補足してログ出力を行う | |
Signal.trap(:EXIT) { logger.fatal($!) if $! && !($!.is_a?(SystemExit) && $!.success?) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment