diff options
author | Arne Juul <arnej@verizonmedia.com> | 2020-03-31 11:49:07 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2020-04-06 12:43:06 +0000 |
commit | a9d6bfd2abf85dbedef3f492b349ceec65a255be (patch) | |
tree | e5671de2df9956c1918eef94a775024edef59c85 /vespalog/src/main/java | |
parent | 9ebcae1800464421a6c823635f9994e36dd68b67 (diff) |
use append semantics when writing lines to logcontrol file
Diffstat (limited to 'vespalog/src/main/java')
-rw-r--r-- | vespalog/src/main/java/com/yahoo/log/VespaLevelControllerRepo.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/vespalog/src/main/java/com/yahoo/log/VespaLevelControllerRepo.java b/vespalog/src/main/java/com/yahoo/log/VespaLevelControllerRepo.java index 86eba1c019e..93a03bbc1b7 100644 --- a/vespalog/src/main/java/com/yahoo/log/VespaLevelControllerRepo.java +++ b/vespalog/src/main/java/com/yahoo/log/VespaLevelControllerRepo.java @@ -4,6 +4,7 @@ package com.yahoo.log; import com.yahoo.text.Utf8; import java.io.RandomAccessFile; +import java.io.FileOutputStream; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; import java.util.Enumeration; @@ -11,6 +12,8 @@ import java.util.TimerTask; import java.util.logging.LogManager; import java.util.logging.Logger; +import static java.nio.charset.StandardCharsets.US_ASCII; + /** * @author Ulf Lilleengen * @since 5.1 @@ -181,8 +184,12 @@ public class VespaLevelControllerRepo implements LevelControllerRepo { sb.append(" "); } sb.append(inherit.getOnOffString()).append("\n"); + byte[] lineBytes = sb.toString().getBytes(US_ASCII); + try (var out = new FileOutputStream(logControlFilename, true)) { + out.write(lineBytes); + out.flush(); + } ctlFile.seek(ctlFile.length()); - ctlFile.writeBytes(sb.toString()); extendMapping(); ctrl = levelControllerRepo.getLevelController(suffix); } catch(java.nio.channels.ClosedByInterruptException e) { |