Package nxt.util
Class MemoryHandler
- java.lang.Object
-
- java.util.logging.Handler
-
- nxt.util.MemoryHandler
-
public class MemoryHandler extends java.util.logging.Handler
MemoryHandler maintains a ring buffer of log messages. The GetLog API is used to retrieve these log messages. The following logging.properties entries are used:- nxt.util.MemoryHandler.level (default ALL)
- nxt.util.MemoryHandler.size (default 100, minimum 10)
-
-
Constructor Summary
Constructors Constructor Description MemoryHandler()
Create a MemoryHandler and configure it based on LogManager properties
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the handlervoid
flush()
Flush the ring bufferjava.util.List<java.lang.String>
getMessages(int msgCount)
Return the log messages from the ring buffervoid
publish(java.util.logging.LogRecord record)
Store a LogRecord in the ring buffer
-
-
-
Method Detail
-
publish
public void publish(java.util.logging.LogRecord record)
Store a LogRecord in the ring buffer- Specified by:
publish
in classjava.util.logging.Handler
- Parameters:
record
- Description of the log event. A null record is silently ignored and is not published
-
getMessages
public java.util.List<java.lang.String> getMessages(int msgCount)
Return the log messages from the ring buffer- Parameters:
msgCount
- Number of messages to return- Returns:
- List of log messages
-
flush
public void flush()
Flush the ring buffer- Specified by:
flush
in classjava.util.logging.Handler
-
close
public void close()
Close the handler- Specified by:
close
in classjava.util.logging.Handler
-
-