public abstract class IfsFileRotationHandler extends StreamHandler
Modifier and Type | Class and Description |
---|---|
protected class |
IfsFileRotationHandler.MeteredStream
Wrap an output stream and count the number of bytes written
|
Modifier and Type | Field and Description |
---|---|
protected File |
m_CurrentLogFile |
Constructor and Description |
---|
IfsFileRotationHandler() |
Modifier and Type | Method and Description |
---|---|
protected IfsFileRotationHandler.MeteredStream |
buildMeteredStream(OutputStream out,
int written)
Build a stream that counts bytes written.
|
protected void |
checkFileRotation()
Check if the file size limit is reached and rotate if so.
|
protected abstract void |
open(File logFile)
Open the log file.
|
void |
publish(LogRecord logRecord)
Format and publish a Log request
|
protected void |
setupRotationLogging(String logFilePath,
int fileSizeLimit,
int maxNumberFiles,
long rotationMillis)
Set up logging to rotate through a set of files.
|
void |
startTimeBasedRotation()
Begin time-based rotation.
|
close, flush, isLoggable, setEncoding, setOutputStream
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, reportError, setErrorManager, setFilter, setFormatter, setLevel
protected File m_CurrentLogFile
protected abstract void open(File logFile) throws IOException
logFile
- a File object holding the location of the logfile.IOException
- if the operation failsprotected void setupRotationLogging(String logFilePath, int fileSizeLimit, int maxNumberFiles, long rotationMillis)
logFilePath
- a String containing the path to the current
log file.fileSizeLimit
- an int containing the max size in bytes that
a file will grow to before rotating.maxNumberFiles
- an int containing the number of files to rotate through.rotationMillis
- a long containing the number of milliseconds between
rotations.public void publish(LogRecord logRecord)
publish
in class StreamHandler
logRecord
- a LogRecord holding the log requestpublic void startTimeBasedRotation()
protected IfsFileRotationHandler.MeteredStream buildMeteredStream(OutputStream out, int written)
out
- the output streamwritten
- the max sizeprotected void checkFileRotation()
Copyright © 2023. All rights reserved.