Class 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()booleanlongStable lower-bound estimate of the bytes this entry retains on the heap, counting only the primary request/response body bytes (the dominant cost for large LLM-capture exchanges).Object[]longgetHttpUpdatedRequests(Configuration configuration) AsgetHttpUpdatedRequests()but consultingconfigurationforredactSecretsInLog, so redaction enabled on aConfigurationinstance (including viaPUT /mockserver/configuration) applies to the dashboard and the JSON log-message surface.getHttpUpdatedResponse(Configuration configuration) org.slf4j.event.LevelgetPort()LikegetHttpRequest()but with sensitive data masked whenmockserver.redactSecretsInLogis enabled; returns the raw request unchanged when redaction is off.getRedactedHttpRequest(Configuration configuration) LikegetHttpRequests()but with sensitive headers / configured JSON body fields masked whenmockserver.redactSecretsInLogis enabled.getRedactedHttpRequests(Configuration configuration) LikegetHttpResponse()but with sensitive data masked whenmockserver.redactSecretsInLogis enabled; returns the raw response unchanged when redaction is off.getRedactedHttpResponse(Configuration configuration) getType()inthashCode()id()booleanbooleanbooleanbooleanmatches(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) setSkipRecordedRequestPersistence(boolean skipRecordedRequestPersistence) 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
-
estimatedHeapSize
public long estimatedHeapSize()Stable lower-bound estimate of the bytes this entry retains on the heap, counting only the primary request/response body bytes (the dominant cost for large LLM-capture exchanges). It deliberately ignores the lazily-derivedhttpUpdated*copies and theargumentsarray so the value never changes after the entry is built — the byte-budget eviction relies on the add-time weight matching the evict-time weight exactly. Reads thehttpRequestsfield directly (notgetHttpRequests(), which substitutes a default request when unset). -
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
-
getHttpUpdatedRequests
AsgetHttpUpdatedRequests()but consultingconfigurationforredactSecretsInLog, so redaction enabled on aConfigurationinstance (including viaPUT /mockserver/configuration) applies to the dashboard and the JSON log-message surface. Falls back to the static store whenconfigurationisnull.NOTE the result is memoised on first call, so toggling redaction after an entry has already been rendered does not retroactively change that entry.
- Parameters:
configuration- the effective server configuration (may benull)
-
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. -
getRedactedHttpRequests
- Parameters:
configuration- the effective server configuration, consulted forredactSecretsInLog(may benull, in which case the static store is used)- See Also:
-
getRedactedHttpRequest
LikegetHttpRequest()but with sensitive data masked whenmockserver.redactSecretsInLogis enabled; returns the raw request unchanged when redaction is off. Used by theretrieveRecordedRequestsAndResponsespath. -
getRedactedHttpRequest
- Parameters:
configuration- the effective server configuration (may benull)- See Also:
-
getRedactedHttpResponse
LikegetHttpResponse()but with sensitive data masked whenmockserver.redactSecretsInLogis enabled; returns the raw response unchanged when redaction is off. Used by theretrieveRecordedRequestsAndResponsespath. -
getRedactedHttpResponse
- Parameters:
configuration- the effective server configuration (may benull)- See Also:
-
matches
-
setHttpRequests
-
getHttpRequest
-
setHttpRequest
-
getHttpResponse
-
getHttpUpdatedResponse
-
getHttpUpdatedResponse
AsgetHttpUpdatedResponse()but consultingconfigurationforredactSecretsInLog. Memoised on first call, as above.- Parameters:
configuration- the effective server configuration (may benull)
-
setHttpResponse
-
getHttpError
-
setHttpError
-
getExpectation
-
setExpectation
-
setExpectation
-
getExpectationId
-
setExpectationId
-
matchesAnyExpectationId
-
getThrowable
-
setThrowable
-
getConsumer
-
setConsumer
-
isDeleted
public boolean isDeleted() -
setDeleted
-
isSkipRecordedRequestPersistence
public boolean isSkipRecordedRequestPersistence() -
setSkipRecordedRequestPersistence
-
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
-