public class LogBuffer
extends java.util.logging.Handler
Handler implementation used to buffer log records for later publishing by one or more dynamically defined
Handler instances.| Modifier and Type | Field and Description |
|---|---|
static int |
BUFFER_LIMIT
The maximum number of log records stored in the buffer.
|
| Constructor and Description |
|---|
LogBuffer() |
| Modifier and Type | Method and Description |
|---|---|
void |
addHandler(java.util.logging.Handler handler)
Add a
Handler. |
static void |
addHandler(java.util.logging.Logger logger,
java.util.logging.Handler handler)
Get the
LogBuffer and add a Handler. |
void |
clear()
Clear this log buffer.
|
static void |
clear(java.util.logging.Logger logger)
Get the
LogBuffer and clear it's content. |
void |
close() |
void |
exportTo(java.io.File file)
Export this log buffer's content to a file.
|
static void |
exportTo(java.util.logging.Logger logger,
java.io.File file)
Get the
LogBuffer and export it's content. |
void |
flush() |
static LogBuffer |
getInstance(java.util.logging.Logger logger)
Get the
LogBuffer instance attached to a given Logger. |
void |
publish(java.util.logging.LogRecord record) |
void |
removeHandler(java.util.logging.Handler handler)
Remove a
Handler. |
static void |
removeHandler(java.util.logging.Logger logger,
java.util.logging.Handler handler)
Get the
LogBuffer and remove a Handler. |
public static final int BUFFER_LIMIT
@Nullable public static LogBuffer getInstance(java.util.logging.Logger logger)
LogBuffer instance attached to a given Logger.logger - The logger to get the log buffer for.null if none has been configured.public static void addHandler(java.util.logging.Logger logger,
java.util.logging.Handler handler)
LogBuffer and add a Handler.
If no log buffer has been configured for the submitted logger, this function does nothing.
logger - The logger to get the log buffer for.handler - The handler to add.getInstance(Logger),
addHandler(Handler)public void addHandler(java.util.logging.Handler handler)
Handler.
Any already buffered log records is published to the submitted handler.
handler - The handler to add.public static void removeHandler(java.util.logging.Logger logger,
java.util.logging.Handler handler)
LogBuffer and remove a Handler.
If no log buffer has been configured for the submitted logger, this function does nothing.
logger - The logger to get the log buffer for.handler - The handler to remove.getInstance(Logger),
removeHandler(Handler)public void removeHandler(java.util.logging.Handler handler)
Handler.handler - The handler to remove.public static void clear(java.util.logging.Logger logger)
LogBuffer and clear it's content.
If no log buffer has been configured for the submitted logger, this function does nothing.
logger - The logger to get the log buffer for.getInstance(Logger),
clear()public void clear()
public static void exportTo(java.util.logging.Logger logger,
java.io.File file)
throws java.io.IOException
LogBuffer and export it's content.
If no log buffer has been configured for the submitted logger, this function does nothing.
logger - The logger to get the log buffer for.file - The file to export to.java.io.IOException - if an I/O error occurs.getInstance(Logger),
exportTo(File)public void exportTo(java.io.File file)
throws java.io.IOException
file - The file to export to.java.io.IOException - if an I/O error occurs.public void publish(@Nullable java.util.logging.LogRecord record)
publish in class java.util.logging.Handlerpublic void flush()
flush in class java.util.logging.Handlerpublic void close()
throws java.lang.SecurityException
close in class java.util.logging.Handlerjava.lang.SecurityException