Last active
August 29, 2015 14:16
-
-
Save ma2gedev/24f19bae533d986476c3 to your computer and use it in GitHub Desktop.
chrono_logger gem の紹介しつつ Rails アプリのロギングを振り返る ref: http://qiita.com/ma2ge/items/1fba78a08e8d3b82b3c2
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
| # cronolog installed in /usr/sbin/ | |
| # in config/environments/{development,production}.rb | |
| config.logger = Logger.new(IO.popen("/usr/sbin/cronolog #{config.paths['log'].first}.%Y%m%d", "w")) |
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
| # 2015/02/01 | |
| logger = Logger.new('logfile', 'daily') | |
| # => logfile is generated | |
| logger.info 'today' | |
| # 2015/02/02 | |
| logger.info 'next day' | |
| # => logfile.20150201 is generated |
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
| # 2015/02/01 | |
| logger = Logger.new(IO.popen("/usr/sbin/cronolog logfile.%Y%m%d", "w")) | |
| logger.info 'today' | |
| # => logfile.20150201 is generated | |
| # 2015/02/02 | |
| logger.info 'next day' | |
| # => logfile.20150202 is generated |
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
| # in Gemfile | |
| gem 'chrono_logger' | |
| # in config/environments/{development,production}.rb | |
| config.logger = ChronoLogger.new("#{config.paths['log'].first}.%Y%m%d") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment