Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private[spark] class FileAppender(inputStream: InputStream, file: File, bufferSi

/** Open the file output stream */
protected def openFile() {
outputStream = new FileOutputStream(file, false)
outputStream = new FileOutputStream(file, true)
logDebug(s"Opened file $file")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ class FileAppenderSuite extends SparkFunSuite with BeforeAndAfter with Logging {
test("basic file appender") {
val testString = (1 to 1000).mkString(", ")
val inputStream = new ByteArrayInputStream(testString.getBytes(StandardCharsets.UTF_8))
// The `header` should not be covered
val header = "Add header"
Files.write(header, testFile, StandardCharsets.UTF_8)
val appender = new FileAppender(inputStream, testFile)
inputStream.close()
appender.awaitTermination()
assert(Files.toString(testFile, StandardCharsets.UTF_8) === testString)
assert(Files.toString(testFile, StandardCharsets.UTF_8) === header + testString)
}

test("rolling file appender - time-based rolling") {
Expand Down