Inter-process locking for log rotation

This pull request is actually addressing the same issue with https://github.com/ruby/ruby/pull/354. 

Current ruby's standard logger errors when we use it with log shifting in multi-process environments. Following is a code snippet to re-produce this problem. 

```ruby
require 'logger'
require 'parallel'

logger = Logger.new("/tmp/test.log", 3, 1024 * 10)
Parallel.map(['a', 'b'], :in_processes => 2) do |letter|
  300000.times do
    logger.info letter * 5000
  end
end
```

By executing this, logger errors like
```
log writing failed. closed stream
log shifting failed. closed stream
log writing failed. closed stream
log shifting failed. closed stream
...
```

Please read [my blog post](http://blog.livedoor.jp/sonots/archives/32645828.html) (Japanese) which I wrote before for more details.

This patch is to fix the issue using inter-process locking (flock).