Class LogEntry

java.lang.Object
org.mockserver.log.model.LogEntry
All Implemented Interfaces:
com.lmax.disruptor.EventTranslator<LogEntry>

public class LogEntry extends Object implements com.lmax.disruptor.EventTranslator<LogEntry>
Author:
jamesdbloom
  • Field Details

    • LOG_DATE_FORMAT

      public static final LogEntry.LogDateFormat LOG_DATE_FORMAT
      Thread-safe replacement for the previous shared SimpleDateFormat.

      SimpleDateFormat is NOT thread-safe; this single static instance was formatted concurrently from the Disruptor log handler and the retrieve/export/serialize threads, which can corrupt its internal Calendar and produce garbled timestamps or an intermittent ArrayIndexOutOfBoundsException. DateTimeFormatter is immutable and thread-safe, so a single shared instance is safe to format from any number of threads. The pattern and the system-default zone reproduce exactly the same output the old SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS") (which used the default zone) produced, so timestamp strings remain byte-for-byte identical.

  • Constructor Details

    • LogEntry

      public LogEntry()
  • Method Details

    • id

      public String id()
    • clear

      public void clear()
    • getLogLevel

      public org.slf4j.event.Level getLogLevel()
    • setLogLevel

      public LogEntry setLogLevel(org.slf4j.event.Level logLevel)
    • isAlwaysLog

      public boolean isAlwaysLog()
    • setAlwaysLog

      public LogEntry setAlwaysLog(boolean alwaysLog)
    • getEpochTime

      public long getEpochTime()
    • setEpochTime

      public LogEntry setEpochTime(long epochTime)
    • getTimestamp

      public String getTimestamp()
    • getType

      public LogEntry.LogMessageType getType()
    • setType

      public LogEntry setType(LogEntry.LogMessageType type)
    • getCorrelationId

      public String getCorrelationId()
    • setCorrelationId

      public LogEntry setCorrelationId(String correlationId)
    • setPort

      public LogEntry setPort(Integer port)
    • getPort

      public Integer getPort()
    • getHttpRequests

      public RequestDefinition[] getHttpRequests()
    • getHttpUpdatedRequests

      public RequestDefinition[] getHttpUpdatedRequests()
    • getRedactedHttpRequests

      public RequestDefinition[] getRedactedHttpRequests()
      Like getHttpRequests() but with sensitive headers / configured JSON body fields masked when mockserver.redactSecretsInLog is enabled. Unlike getHttpUpdatedRequests() this does NOT apply body templating (updateBody), so when redaction is off it returns the raw requests byte-for-byte unchanged — it is the redaction-aware view for the retrieveRecordedRequests / export paths, which must otherwise preserve the captured request exactly.
    • getRedactedHttpRequest

      public RequestDefinition getRedactedHttpRequest()
      Like getHttpRequest() but with sensitive data masked when mockserver.redactSecretsInLog is enabled; returns the raw request unchanged when redaction is off. Used by the retrieveRecordedRequestsAndResponses path.
    • getRedactedHttpResponse

      public HttpResponse getRedactedHttpResponse()
      Like getHttpResponse() but with sensitive data masked when mockserver.redactSecretsInLog is enabled; returns the raw response unchanged when redaction is off. Used by the retrieveRecordedRequestsAndResponses path.
    • matches

      public boolean matches(HttpRequestMatcher matcher)
    • setHttpRequests

      public LogEntry setHttpRequests(RequestDefinition[] httpRequests)
    • getHttpRequest

      public RequestDefinition getHttpRequest()
    • setHttpRequest

      public LogEntry setHttpRequest(RequestDefinition httpRequest)
    • getHttpResponse

      public HttpResponse getHttpResponse()
    • getHttpUpdatedResponse

      public HttpResponse getHttpUpdatedResponse()
    • setHttpResponse

      public LogEntry setHttpResponse(HttpResponse httpResponse)
    • getHttpError

      public HttpError getHttpError()
    • setHttpError

      public LogEntry setHttpError(HttpError httpError)
    • getExpectation

      public Expectation getExpectation()
    • setExpectation

      public LogEntry setExpectation(Expectation expectation)
    • setExpectation

      public LogEntry setExpectation(RequestDefinition httpRequest, HttpResponse httpResponse)
    • getExpectationId

      public String getExpectationId()
    • setExpectationId

      public LogEntry setExpectationId(String expectationId)
    • matchesAnyExpectationId

      public boolean matchesAnyExpectationId(List<String> expectationIds)
    • getThrowable

      public Throwable getThrowable()
    • setThrowable

      public LogEntry setThrowable(Throwable throwable)
    • getConsumer

      public Runnable getConsumer()
    • setConsumer

      public LogEntry setConsumer(Runnable consumer)
    • isDeleted

      public boolean isDeleted()
    • setDeleted

      public LogEntry setDeleted(boolean deleted)
    • getMessageFormat

      public String getMessageFormat()
    • setMessageFormat

      public LogEntry setMessageFormat(String messageFormat)
    • getMessage

      public String getMessage()
    • getCompactMessage

      public String getCompactMessage()
    • getArguments

      public Object[] getArguments()
    • setArguments

      public LogEntry setArguments(Object... arguments)
    • getBecause

      public String getBecause()
    • setBecause

      public LogEntry setBecause(String because)
    • cloneAndClear

      public LogEntry cloneAndClear()
    • clone

      public LogEntry clone()
      Overrides:
      clone in class Object
    • translateTo

      public void translateTo(LogEntry event, long sequence)
      Specified by:
      translateTo in interface com.lmax.disruptor.EventTranslator<LogEntry>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object