Package org.mockserver.log.model
Class LogEntry
java.lang.Object
org.mockserver.log.model.LogEntry
- All Implemented Interfaces:
com.lmax.disruptor.EventTranslator<LogEntry>
- Author:
- jamesdbloom
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classTiny thread-safe formatter exposing the sameformat(Date)call shape the previous publicDateFormat LOG_DATE_FORMATfield offered, backed by an immutableDateTimeFormatter.static enumstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final LogEntry.LogDateFormatThread-safe replacement for the previous sharedSimpleDateFormat. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()clone()booleanObject[]longorg.slf4j.event.LevelgetPort()LikegetHttpRequest()but with sensitive data masked whenmockserver.redactSecretsInLogis enabled; returns the raw request unchanged when redaction is off.LikegetHttpRequests()but with sensitive headers / configured JSON body fields masked whenmockserver.redactSecretsInLogis enabled.LikegetHttpResponse()but with sensitive data masked whenmockserver.redactSecretsInLogis enabled; returns the raw response unchanged when redaction is off.getType()inthashCode()id()booleanbooleanbooleanmatches(HttpRequestMatcher matcher) booleanmatchesAnyExpectationId(List<String> expectationIds) setAlwaysLog(boolean alwaysLog) setArguments(Object... arguments) setBecause(String because) setConsumer(Runnable consumer) setCorrelationId(String correlationId) setDeleted(boolean deleted) setEpochTime(long epochTime) setExpectation(Expectation expectation) setExpectation(RequestDefinition httpRequest, HttpResponse httpResponse) setExpectationId(String expectationId) setHttpError(HttpError httpError) setHttpRequest(RequestDefinition httpRequest) setHttpRequests(RequestDefinition[] httpRequests) setHttpResponse(HttpResponse httpResponse) setLogLevel(org.slf4j.event.Level logLevel) setMessageFormat(String messageFormat) setThrowable(Throwable throwable) toString()voidtranslateTo(LogEntry event, long sequence)
-
Field Details
-
LOG_DATE_FORMAT
Thread-safe replacement for the previous sharedSimpleDateFormat.SimpleDateFormatis 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 internalCalendarand produce garbled timestamps or an intermittentArrayIndexOutOfBoundsException.DateTimeFormatteris 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 oldSimpleDateFormat("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
-
clear
public void clear() -
getLogLevel
public org.slf4j.event.Level getLogLevel() -
setLogLevel
-
isAlwaysLog
public boolean isAlwaysLog() -
setAlwaysLog
-
getEpochTime
public long getEpochTime() -
setEpochTime
-
getTimestamp
-
getType
-
setType
-
getCorrelationId
-
setCorrelationId
-
setPort
-
getPort
-
getHttpRequests
-
getHttpUpdatedRequests
-
getRedactedHttpRequests
LikegetHttpRequests()but with sensitive headers / configured JSON body fields masked whenmockserver.redactSecretsInLogis enabled. UnlikegetHttpUpdatedRequests()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 theretrieveRecordedRequests/ export paths, which must otherwise preserve the captured request exactly. -
getRedactedHttpRequest
LikegetHttpRequest()but with sensitive data masked whenmockserver.redactSecretsInLogis enabled; returns the raw request unchanged when redaction is off. Used by theretrieveRecordedRequestsAndResponsespath. -
getRedactedHttpResponse
LikegetHttpResponse()but with sensitive data masked whenmockserver.redactSecretsInLogis enabled; returns the raw response unchanged when redaction is off. Used by theretrieveRecordedRequestsAndResponsespath. -
matches
-
setHttpRequests
-
getHttpRequest
-
setHttpRequest
-
getHttpResponse
-
getHttpUpdatedResponse
-
setHttpResponse
-
getHttpError
-
setHttpError
-
getExpectation
-
setExpectation
-
setExpectation
-
getExpectationId
-
setExpectationId
-
matchesAnyExpectationId
-
getThrowable
-
setThrowable
-
getConsumer
-
setConsumer
-
isDeleted
public boolean isDeleted() -
setDeleted
-
getMessageFormat
-
setMessageFormat
-
getMessage
-
getCompactMessage
-
getArguments
-
setArguments
-
getBecause
-
setBecause
-
cloneAndClear
-
clone
-
translateTo
- Specified by:
translateToin interfacecom.lmax.disruptor.EventTranslator<LogEntry>
-
equals
-
hashCode
public int hashCode() -
toString
-