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 and Description
    `MemoryHandler()` Create a MemoryHandler and configure it based on LogManager properties

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Close the handler
    `void` | `flush()` Flush the ring buffer
    `java.util.List<java.lang.String>` | `getMessages(int msgCount)` Return the log messages from the ring buffer
    `void` | `publish(java.util.logging.LogRecord record)` Store a LogRecord in the ring buffer

    - ### Methods inherited from class java.util.logging.Handler

      `getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MemoryHandler

          public MemoryHandler()

      Create a MemoryHandler and configure it based on LogManager properties

  - ### Method Detail

    - #### publish

          public void publish(java.util.logging.LogRecord record)

      Store a LogRecord in the ring buffer
      Specified by:
        `publish` in class `java.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 class `java.util.logging.Handler`

    - #### close

          public void close()

      Close the handler
      Specified by:
        `close` in class `java.util.logging.Handler`