diff --git a/ChangeLog b/ChangeLog index e7cc2ddada..ff74219b0b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Nov 20 23:15:18 2015 Naotoshi Seo + + * lib/logger.rb: expose logger mutex + [fix GH-541] Patch by @arthurnn + Fri Nov 20 15:05:28 2015 SHIBATA Hiroshi * Added missing reference of GitHub diff --git a/lib/logger.rb b/lib/logger.rb index d17896f841..77b08fe204 100644 --- a/lib/logger.rb +++ b/lib/logger.rb @@ -626,14 +626,11 @@ private attr_reader :dev attr_reader :filename - - class LogDeviceMutex - include MonitorMixin - end + include MonitorMixin def initialize(log = nil, opt = {}) @dev = @filename = @shift_age = @shift_size = nil - @mutex = LogDeviceMutex.new + mon_initialize set_dev(log) if @filename @shift_age = opt[:shift_age] || 7 @@ -644,7 +641,7 @@ private def write(message) begin - @mutex.synchronize do + synchronize do if @shift_age and @dev.respond_to?(:stat) begin check_shift_log @@ -665,7 +662,7 @@ private def close begin - @mutex.synchronize do + synchronize do @dev.close rescue nil end rescue Exception @@ -677,7 +674,7 @@ private # reopen the same filename if no argument, do nothing for IO log ||= @filename if @filename if log - @mutex.synchronize do + synchronize do if @filename and @dev @dev.close rescue nil # close only file opened by Logger @filename = nil