public class LegacyLogManagerClientServiceImpl extends java.lang.Object implements LegacyLogManagerClientService
| Modifier and Type | Field and Description |
|---|---|
private java.nio.channels.FileChannel |
channel
The file channel associated with the output stream.
|
private java.io.FileOutputStream |
fileOutputStream
The output stream to write to the log file.
|
private java.lang.String |
filePath
The file path.
|
private static CentralLogger |
LOG
Logger.
|
private java.nio.channels.FileLock |
rotationLock
The lock to the file channel, when rotation is enabled.
|
| Constructor and Description |
|---|
LegacyLogManagerClientServiceImpl()
Default public constructor for LegacyLogManagerClientServiceImpl.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cleanupRotation(java.lang.String filePath,
int numLogFiles)
Removes the sequenced log files with the same name in the same folder that exceed the max count of
numLogFiles, while preserving the current log file and of its predecessors.
|
boolean |
clear()
Clears the content of the currently open log file.
|
boolean |
close()
Closes the file.
|
boolean |
isWritable(java.lang.String filePath)
Returns a flag to indicate if the file path is writable.
|
java.lang.String |
makeSequencedLogFile(java.lang.String logFileConfig,
int logThreshold)
Receives the clean file path from configs and returns the path modified with rotation number, next in
the sequence based on the existing files in the folder.
|
boolean |
open(java.lang.String filePath)
Opens the file for writing.
|
void |
write(java.util.List<java.lang.String> logManagerRecords)
Writes multiple log record.
|
boolean |
write(java.lang.String logRecord)
Writes the log record.
|
private static final CentralLogger LOG
private java.lang.String filePath
private java.io.FileOutputStream fileOutputStream
private java.nio.channels.FileChannel channel
private java.nio.channels.FileLock rotationLock
public LegacyLogManagerClientServiceImpl()
public boolean isWritable(java.lang.String filePath)
isWritable in interface LegacyLogManagerClientServicefilePath - The file path to check for.true if the folder is writable, false otherwise.public java.lang.String makeSequencedLogFile(java.lang.String logFileConfig,
int logThreshold)
makeSequencedLogFile in interface LegacyLogManagerClientServicelogFileConfig - The clean file path from configs.logThreshold - The size of the file before rolling over.public boolean open(java.lang.String filePath)
open in interface LegacyLogManagerClientServicefilePath - The file path.true if successful, false otherwise.public boolean write(java.lang.String logRecord)
write in interface LegacyLogManagerClientServicelogRecord - The log record.true if successful, false otherwise.public boolean close()
close in interface LegacyLogManagerClientServicetrue if successful, false otherwise.public boolean clear()
clear in interface LegacyLogManagerClientServicetrue if successful, false otherwise.public void cleanupRotation(java.lang.String filePath,
int numLogFiles)
cleanupRotation in interface LegacyLogManagerClientServicefilePath - The log record.numLogFiles - The log record.public void write(java.util.List<java.lang.String> logManagerRecords)
logManagerRecords - The log records.