diff options
author | Jacob Vosmaer (GitLab) <jacob@gitlab.com> | 2018-03-23 12:24:34 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-03-23 12:24:34 +0000 |
commit | 9087e96083fcfe22c2cb111add55d3d0009eda9a (patch) | |
tree | 0023ae5c66b9da5250ed914ae93d665f7250df88 /lib/gitlab_logger.rb | |
parent | e19b08ba3f985eacfdf0ecf1c06799959d02cfe7 (diff) | |
download | gitlab-shell-9087e96083fcfe22c2cb111add55d3d0009eda9a.tar.gz |
Flush log file after every write
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 |