Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sonots/process_safe_logger
Process-safe Logger supports log rotations in multi-processes safely
https://github.com/sonots/process_safe_logger
Last synced: 2 months ago
JSON representation
Process-safe Logger supports log rotations in multi-processes safely
- Host: GitHub
- URL: https://github.com/sonots/process_safe_logger
- Owner: sonots
- License: other
- Created: 2013-10-19T03:25:17.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-05-20T10:00:56.000Z (over 9 years ago)
- Last Synced: 2024-04-13T05:00:43.282Z (9 months ago)
- Language: Ruby
- Homepage:
- Size: 188 KB
- Stars: 14
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Process Safe Logger [![Build Status](https://secure.travis-ci.org/sonots/process_safe_logger.png?branch=master)](http://travis-ci.org/sonots/process_safe_logger) [![Dependency Status](https://gemnasium.com/sonots/process_safe_logger.png)](https://gemnasium.com/sonots/process_safe_logger)
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](https://github.com/ruby/ruby/pull/428) and will be released with ruby 2.1.0.
## Installation
gem install process_safe_logger
## Usage
```ruby
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](http://docs.ruby-lang.org/en/2.0.0/Logger.html).
## Further Reading
1. [sonots:blog : RubyのLoggerはスレッドセーフ(&プロセスセーフ)かどうか調べてみた](http://blog.livedoor.jp/sonots/archives/32645828.html) (Japanese)
2. [Inter-process locking for log rotation by sonots · Pull Request #428 · ruby/ruby](https://github.com/ruby/ruby/pull/428)## 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](../../pull/new/master)## License
Same with ruby.