Class GrowJulHandler

java.lang.Object
java.util.logging.Handler
codes.grow.packages.betterstack.logging.GrowJulHandler

public final class GrowJulHandler extends Handler
java.util.logging handler that forwards records to a LogClient.

 java.util.logging.Logger.getLogger("").addHandler(new GrowJulHandler(logClient));
 

Levels map as SEVERE → ERROR, WARNING → WARN, INFO → INFO, CONFIG/FINE → DEBUG, FINER/FINEST → TRACE. close() flushes but does not close the client (the application owns it).

  • Constructor Details

    • GrowJulHandler

      public GrowJulHandler(LogClient client)
      Creates the handler.
      Parameters:
      client - destination
  • Method Details

    • severityOf

      public static Severity severityOf(Level level)
      Maps a JUL level to a severity.
      Parameters:
      level - JUL level
      Returns:
      severity
    • publish

      public void publish(LogRecord record)
      Specified by:
      publish in class Handler
    • flush

      public void flush()
      Specified by:
      flush in class Handler
    • close

      public void close()
      Specified by:
      close in class Handler