No commit activity in last 3 years
No release in over 3 years
Process-safe Logger supports log rotations in multi-processes safely
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
~> 2.11
 Project Readme

Process Safe Logger Build Status Dependency Status

testing ruby: 1.9.3, 2.0.0;

About Process Safe Logger

Process Safe Logger supports log rotations in multi-processes safely.

Objective

Ruby's standard Logger class originally have had a problem that it's log rotation function does not work safely in multi process environment. This gem fixes the problem.

The patch is already pull requested to the github.com:ruby/ruby and will be released with ruby 2.1.0.

Installation

gem install process_safe_logger

Usage

require 'process_safe_logger'
logger = ProcessSafeLogger.new('logfile.log', 3, 1024)

Option parameters are same with Ruby's Logger. See docs.ruby-lang.org:Logger.

Further Reading

  1. sonots:blog : RubyのLoggerはスレッドセーフ(&プロセスセーフ)かどうか調べてみた (Japanese)
  2. Inter-process locking for log rotation by sonots · Pull Request #428 · ruby/ruby

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

Same with ruby.