public class FileLogger extends Object implements ExecutionLogger
Constructor and Description |
---|
FileLogger(File outputFile)
Creates a new logger that writes to the specified file.
|
FileLogger(File outputFile,
Log log)
Creates a new logger that writes to the specified file and optionally mirrors messages to the given mojo logger.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the underlying file stream.
|
void |
consumeLine(String line)
Writes the specified line to the log file and optionally to the mojo logger.
|
protected void |
finalize()
Closes the underlying file stream.
|
File |
getOutputFile()
Gets the path to the output file.
|
PrintStream |
getPrintStream()
Gets the underlying stream used to write message to the log file.
|
public FileLogger(File outputFile) throws IOException
outputFile
- The path to the output file, must not be null
.IOException
- If the output file could not be created.public FileLogger(File outputFile, Log log) throws IOException
outputFile
- The path to the output file, must not be null
.log
- The mojo logger to additionally output messages to, may be null
if not used.IOException
- If the output file could not be created.public File getOutputFile()
null
.public PrintStream getPrintStream()
getPrintStream
in interface ExecutionLogger
null
.public void consumeLine(String line)
consumeLine
in interface ExecutionLogger
line
- The message to log.public void close()
Copyright © 2002–2017 The Apache Software Foundation. All rights reserved.