Record Class ServerErrorSnapshot

java.lang.Object
java.lang.Record
nl.pim16aap2.lightkeeper.framework.ServerErrorSnapshot
Record Components:
timestampMillis - Epoch milliseconds at which the event was created (structured events) or captured (raw stderr output).
severity - Severity bucket; only ServerErrorSnapshot.Severity.ERROR entries fail LightkeeperAssertions.assertThat(framework).hasNoServerErrors().
levelName - Original log level name (e.g. "ERROR", "WARN"), or "STDERR" for raw stderr output.
loggerName - Name of the logger that emitted the event, or LOGGER_NAME_STDERR for raw stderr output.
threadName - Name of the emitting thread; empty when unknown.
message - Formatted log message; for raw stderr output, the first line of the detected stack trace.
throwableClass - Fully-qualified class name of the attached or detected throwable, or null when absent.
throwableMessage - Message of the attached or detected throwable, or null when absent.
stackTrace - Rendered stack trace lines including the cause chain (possibly truncated); empty when no throwable was attached.

public record ServerErrorSnapshot(long timestampMillis, ServerErrorSnapshot.Severity severity, String levelName, String loggerName, String threadName, String message, @Nullable String throwableClass, @Nullable String throwableMessage, List<String> stackTrace) extends Record
Snapshot of a single captured server error or warning.

Entries originate from two complementary sources:

  • Structured log events — captured inside the server by the agent's Log4j appender, carrying the real throwable class, message, and rendered cause chain of the original log event.
  • Raw stderr output — stack traces written to the server process's raw stderr file descriptor, bypassing the logging system entirely (for example Log4j's own status logger or JVM-native output). These entries use "STDERR" as levelName() and LOGGER_NAME_STDERR as loggerName().
  • Field Details

  • Constructor Details

  • Method Details

    • toDisplayString

      public String toDisplayString(int maxStackTraceLines)
      Renders this entry as human-readable text: one header line plus indented stack-trace lines, capped at the given limit with a "... (N more stack trace lines)" tail when truncated.
      Parameters:
      maxStackTraceLines - Maximum number of stack-trace lines to render; use Integer.MAX_VALUE for the full trace.
      Returns:
      The rendered entry, ending with a line separator.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • timestampMillis

      public long timestampMillis()
      Returns the value of the timestampMillis record component.
      Returns:
      the value of the timestampMillis record component
    • severity

      public ServerErrorSnapshot.Severity severity()
      Returns the value of the severity record component.
      Returns:
      the value of the severity record component
    • levelName

      public String levelName()
      Returns the value of the levelName record component.
      Returns:
      the value of the levelName record component
    • loggerName

      public String loggerName()
      Returns the value of the loggerName record component.
      Returns:
      the value of the loggerName record component
    • threadName

      public String threadName()
      Returns the value of the threadName record component.
      Returns:
      the value of the threadName record component
    • message

      public String message()
      Returns the value of the message record component.
      Returns:
      the value of the message record component
    • throwableClass

      public @Nullable String throwableClass()
      Returns the value of the throwableClass record component.
      Returns:
      the value of the throwableClass record component
    • throwableMessage

      public @Nullable String throwableMessage()
      Returns the value of the throwableMessage record component.
      Returns:
      the value of the throwableMessage record component
    • stackTrace

      public List<String> stackTrace()
      Returns the value of the stackTrace record component.
      Returns:
      the value of the stackTrace record component