public final class LoggerStringWriter
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
accumulated()
Get the accumulated content that has been logged.
|
static void |
assertContainsMdcPair(java.lang.String value,
java.lang.String expectedLabel,
java.lang.String expectedValue)
Verify that an MDC
expectedLabel=expectedValue pair is present in value . |
static void |
remove()
Remove the underlying in-memory log appender.
|
static void |
reset()
Clear the content of the
accumulated() . |
static java.lang.String |
stableAccumulated(int totalWaitTimeMillis)
Wait for the
accumulated() content to remain unchanged for delayMillis milliseconds. |
static java.lang.String |
stableAccumulated(int totalWaitTimeMillis,
long sleepDurationMs)
Wait for the
accumulated() content to remain unchanged for sleepDurationMs milliseconds. |
public static void reset()
accumulated()
.public static void remove()
public static java.lang.String accumulated()
public static java.lang.String stableAccumulated(int totalWaitTimeMillis) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException
accumulated()
content to remain unchanged for delayMillis
milliseconds.totalWaitTimeMillis
- The amount of milliseconds to wait for the accumulated()
content to
stabilize.java.lang.InterruptedException
- If interrupted while waiting for log content to stabilize.java.util.concurrent.TimeoutException
- If the totalWaitTimeMillis
duration has been exceeded and the
accumulated()
has not yet stabilize.public static java.lang.String stableAccumulated(int totalWaitTimeMillis, long sleepDurationMs) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException
accumulated()
content to remain unchanged for sleepDurationMs
milliseconds.totalWaitTimeMillis
- The total amount of milliseconds to wait.sleepDurationMs
- The amount of milliseconds to wait between checking if accumulated()
has
stabilize.java.lang.InterruptedException
- If interrupted while waiting for log content to stabilize.java.util.concurrent.TimeoutException
- If the totalWaitTimeMillis
duration has been exceeded and the
accumulated()
has not yet stabilize.public static void assertContainsMdcPair(java.lang.String value, java.lang.String expectedLabel, java.lang.String expectedValue)
expectedLabel=expectedValue
pair is present in value
.value
- The log line.expectedLabel
- The MDC key.expectedValue
- The MDC value.