Constructor and Description |
---|
FileLogger(String logDir,
SparkConf sparkConf) |
FileLogger(String logDir,
SparkConf sparkConf,
boolean compress) |
FileLogger(String logDir,
SparkConf sparkConf,
boolean compress,
boolean overwrite) |
FileLogger(String logDir,
SparkConf sparkConf,
org.apache.hadoop.conf.Configuration hadoopConf,
int outputBufferSize,
boolean compress,
boolean overwrite,
scala.Option<org.apache.hadoop.fs.permission.FsPermission> dirPermissions) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the writer.
|
int |
fileIndex() |
void |
flush()
Flush the writer to disk manually.
|
void |
log(String msg,
boolean withTime)
Log the message to the given writer.
|
void |
logLine(String msg,
boolean withTime)
Log the message to the given writer as a new line.
|
void |
newFile(String fileName,
scala.Option<org.apache.hadoop.fs.permission.FsPermission> perms)
Start a writer for a new file, closing the existing one if it exists.
|
void |
start()
Start this logger by creating the logging directory.
|
void |
stop()
Close all open writers, streams, and file systems.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initializeIfNecessary, initializeLogging, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning
public FileLogger(String logDir, SparkConf sparkConf, org.apache.hadoop.conf.Configuration hadoopConf, int outputBufferSize, boolean compress, boolean overwrite, scala.Option<org.apache.hadoop.fs.permission.FsPermission> dirPermissions)
public FileLogger(String logDir, SparkConf sparkConf, boolean compress, boolean overwrite)
public FileLogger(String logDir, SparkConf sparkConf, boolean compress)
public FileLogger(String logDir, SparkConf sparkConf)
public int fileIndex()
public void start()
public void log(String msg, boolean withTime)
msg
- The message to be loggedwithTime
- Whether to prepend message with a timestamppublic void logLine(String msg, boolean withTime)
msg
- The message to be loggedwithTime
- Whether to prepend message with a timestamppublic void flush()
When using a Hadoop filesystem, we need to invoke the hflush or sync method. In HDFS, hflush guarantees that the data gets to all the DataNodes.
public void close()
public void newFile(String fileName, scala.Option<org.apache.hadoop.fs.permission.FsPermission> perms)
fileName
- Name of the new file, defaulting to the file index if not provided.perms
- Permissions to put on the new file.public void stop()