public class DailyLogListener extends RotateLogListener
Modifier and Type | Class and Description |
---|---|
protected class |
DailyLogListener.Compressor |
RotateLogListener.Rotate
CHECK_INTERVAL, DEFAULT_MAXSIZE
Constructor and Description |
---|
DailyLogListener()
Creates a new instance of DailyLogListener
|
Modifier and Type | Method and Description |
---|---|
protected void |
closeCompressedOutputStream(java.io.OutputStream os) |
protected void |
compress(java.io.File logFile)
Hook method to optionally compress the file
|
void |
deleteOldLogs() |
protected java.io.OutputStream |
getCompressedOutputStream(java.io.File f)
Hook method that creates an output stream that will compress the data.
|
java.lang.String |
getCompressedSuffix()
Getter for property compressedExt.
|
int |
getCompressionBufferSize()
Getter for property compressionBufferSize.
|
int |
getCompressionFormat()
Getter for property compressionFormat.
|
protected java.lang.Thread |
getCompressorThread(java.io.File f)
Hook method that creates a thread to compress the file f.
|
java.text.DateFormat |
getDateFmt()
Getter for property dateFmt.
|
java.lang.String |
getDeleteRegex()
Getter for property deleteRegex.
|
java.lang.String |
getLastDate()
Getter for property lastDate.
|
long |
getMaxAge()
Getter for property maxAge.
|
java.lang.String |
getPrefix()
Getter for property prefix.
|
int |
getRotateCount()
Getter for property rotateCount.
|
java.lang.String |
getSuffix()
Getter for property suffix.
|
protected void |
logDebugEx(java.lang.String msg,
java.lang.Throwable e) |
void |
setCompressedSuffix(java.lang.String compressedSuffix)
Setter for property compressedExt.
|
void |
setCompressionBufferSize(int compressionBufferSize)
Setter for property compressionBufferSize.
|
void |
setCompressionFormat(int compressionFormat)
Setter for property compressionFormat.
|
void |
setConfiguration(Configuration cfg)
Configure this RotateLogListener
Properties: file base log filename [window] in seconds (default 0 - never rotate) [count] number of copies (default 0 == single copy) [maxsize] max log size in bytes (approx) [rotate-on-startup] Rotate file on q2 startup (default: false) [file-name-pattern] Comma-delimited codes for positional token replacement (case sensitive) |
void |
setDateFmt(java.text.DateFormat dateFmt)
Setter for property dateFmt.
|
void |
setDeleteRegex(java.lang.String deleteRegex)
Setter for property deleteRegex.
|
void |
setLastDate(java.lang.String lastDate)
Setter for property lastDate.
|
void |
setMaxAge(long maxAge)
Setter for property maxAge.
|
void |
setPrefix(java.lang.String prefix)
Setter for property prefix.
|
void |
setRotateCount(int rotateCount)
Setter for property rotateCount.
|
void |
setSuffix(java.lang.String suffix)
Setter for property suffix.
|
checkSize, closeLogFile, destroy, fileNameFromPattern, log, logDebug, logRotate, logRotate, openLogFile
accept, close, setConfiguration, setPrintStream
public DailyLogListener()
public void setConfiguration(Configuration cfg) throws ConfigurationException
RotateLogListener
Currently supported file-pattern-codes:
When code replacement fails, the token will be replaced by the code preceded by a # to give an indication of what failed. This type of failure will not result in a startup failure.
file is expected to contain %s tokens for replacement when enabled, as expected by String.format.
setConfiguration
in interface Configurable
setConfiguration
in class RotateLogListener
cfg
- ConfigurationConfigurationException
public void deleteOldLogs() throws java.io.IOException
java.io.IOException
public java.lang.String getSuffix()
public void setSuffix(java.lang.String suffix)
suffix
- New value of property suffix.public java.lang.String getPrefix()
public void setPrefix(java.lang.String prefix)
prefix
- New value of property prefix.public int getRotateCount()
public void setRotateCount(int rotateCount)
rotateCount
- New value of property rotateCount.public java.text.DateFormat getDateFmt()
public void setDateFmt(java.text.DateFormat dateFmt)
dateFmt
- New value of property dateFmt.public java.lang.String getLastDate()
public void setLastDate(java.lang.String lastDate)
lastDate
- New value of property lastDate.public java.lang.String getCompressedSuffix()
public void setCompressedSuffix(java.lang.String compressedSuffix)
compressedSuffix
- New value of property compressedExt.public long getMaxAge()
public void setMaxAge(long maxAge)
maxAge
- new value of property maxAge.public java.lang.String getDeleteRegex()
public void setDeleteRegex(java.lang.String deleteRegex)
deleteRegex
- new value of property deleteRegex.protected java.lang.Thread getCompressorThread(java.io.File f)
f
- the file nameprotected java.io.OutputStream getCompressedOutputStream(java.io.File f) throws java.io.IOException
f
- the file namejava.io.IOException
- on errorprotected void closeCompressedOutputStream(java.io.OutputStream os) throws java.io.IOException
java.io.IOException
protected void logDebugEx(java.lang.String msg, java.lang.Throwable e)
public int getCompressionFormat()
public void setCompressionFormat(int compressionFormat)
compressionFormat
- New value of property compressionFormat.public int getCompressionBufferSize()
public void setCompressionBufferSize(int compressionBufferSize)
compressionBufferSize
- New value of property compressionBufferSize.protected void compress(java.io.File logFile)
logFile
- the file name