public class RotateLogListener extends SimpleLogListener implements java.lang.AutoCloseable, Configurable, Destroyable
Configurable| Modifier and Type | Class and Description |
|---|---|
class |
RotateLogListener.Rotate |
| Modifier and Type | Field and Description |
|---|---|
static int |
CHECK_INTERVAL |
static long |
DEFAULT_MAXSIZE |
| Constructor and Description |
|---|
RotateLogListener() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkSize() |
protected void |
closeLogFile() |
void |
destroy() |
protected java.lang.String |
fileNameFromPattern(java.lang.String inFileName,
java.lang.String patternCodes) |
LogEvent |
log(LogEvent ev) |
protected void |
logDebug(java.lang.String msg) |
void |
logRotate() |
void |
logRotate(boolean isStartup) |
protected void |
openLogFile() |
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) |
accept, close, setConfiguration, setPrintStreampublic static final int CHECK_INTERVAL
public static final long DEFAULT_MAXSIZE
public void setConfiguration(Configuration cfg) throws ConfigurationException
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 Configurablecfg - ConfigurationConfigurationExceptionpublic LogEvent log(LogEvent ev)
log in interface LogListenerlog in class SimpleLogListenerprotected void openLogFile()
throws java.io.IOException
java.io.IOExceptionprotected void closeLogFile()
throws java.io.IOException
java.io.IOExceptionpublic void logRotate()
throws java.io.IOException
java.io.IOExceptionpublic void logRotate(boolean isStartup)
throws java.io.IOException
java.io.IOExceptionprotected void logDebug(java.lang.String msg)
protected void checkSize()
protected java.lang.String fileNameFromPattern(java.lang.String inFileName,
java.lang.String patternCodes)
public void destroy()
destroy in interface Destroyable