diff options
Diffstat (limited to 'lib/gitlab_logger.rb')
-rw-r--r-- | lib/gitlab_logger.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/gitlab_logger.rb b/lib/gitlab_logger.rb index cdca25b..f81c2f6 100644 --- a/lib/gitlab_logger.rb +++ b/lib/gitlab_logger.rb @@ -25,7 +25,13 @@ class GitlabLogger def initialize(level, path, log_format) @level = level + @log_file = File.open(path, 'ab') + # By default Ruby will buffer writes. This is a problem when we exec + # into a new command before Ruby flushed its buffers. Setting 'sync' to + # true disables Ruby's buffering. + @log_file.sync = true + @log_format = log_format end |