Class MultiplexerLogHandler

java.lang.Object
java.util.logging.Handler
com.scivicslab.turingworkflow.plugins.logoutput.MultiplexerLogHandler

public class MultiplexerLogHandler extends Handler
A java.util.logging Handler that forwards log messages to MultiplexerAccumulatorActor.

Bridges java.util.logging with the MultiplexerAccumulator system, allowing all log messages to be captured in the same output destinations (console, file, database) as command output and cowsay.

Since:
1.0
Author:
devteam@scivicslab.com
  • Constructor Details

    • MultiplexerLogHandler

      public MultiplexerLogHandler(com.scivicslab.turingworkflow.workflow.IIActorSystem system)
      Constructs a MultiplexerLogHandler that forwards log records to the outputMultiplexer actor within the given actor system.
      Parameters:
      system - the actor system containing the outputMultiplexer actor
  • Method Details

    • publish

      public void publish(LogRecord record)
      Publishes a log record by formatting it as an ISO 8601 timestamped message and forwarding it to the outputMultiplexer actor via the add action.

      The log entry is sent with:

      • source - a short name derived from the logger name (e.g., "turing-workflow", "pojo-actor", or the simple class name)
      • type - "log-" followed by the log level name (e.g., "log-INFO", "log-SEVERE")
      • data - the formatted log message including timestamp, level, and optional stack trace

      If the handler is closed, the record is null, or the outputMultiplexer actor is not registered, the record is silently discarded.

      Specified by:
      publish in class Handler
      Parameters:
      record - the log record to publish; may be null
    • flush

      public void flush()
      No-op flush. Log entries are forwarded immediately on publish(java.util.logging.LogRecord).
      Specified by:
      flush in class Handler
    • close

      public void close() throws SecurityException
      Closes this handler. After closing, subsequent calls to publish(java.util.logging.LogRecord) will silently discard log records.
      Specified by:
      close in class Handler
      Throws:
      SecurityException - if a security manager denies the operation