public class LoggingEvent extends Object
equals(Object)
and hashCode()
is that they compare the results of:
They do NOT compare the results of getTimestamp()
, getCreatingLogger()
or
getThreadContextClassLoader()
as this would render it impractical to create appropriate
expected LoggingEvent
s to compare against.
Constructors and convenient static factory methods exist to create LoggingEvent
s with
appropriate defaults. These are not documented further as they should be self-evident.
Constructor and Description |
---|
LoggingEvent(org.slf4j.event.Level level,
Map<String,String> mdc,
org.slf4j.Marker marker,
String message,
Object... arguments) |
LoggingEvent(org.slf4j.event.Level level,
Map<String,String> mdc,
org.slf4j.Marker marker,
Throwable throwable,
String message,
Object... arguments) |
LoggingEvent(org.slf4j.event.Level level,
Map<String,String> mdc,
String message,
Object... arguments) |
LoggingEvent(org.slf4j.event.Level level,
Map<String,String> mdc,
Throwable throwable,
String message,
Object... arguments) |
LoggingEvent(org.slf4j.event.Level level,
org.slf4j.Marker marker,
String message,
Object... arguments) |
LoggingEvent(org.slf4j.event.Level level,
org.slf4j.Marker marker,
Throwable throwable,
String message,
Object... arguments) |
LoggingEvent(org.slf4j.event.Level level,
String message,
Object... arguments) |
LoggingEvent(org.slf4j.event.Level level,
Throwable throwable,
String message,
Object... arguments) |
Modifier and Type | Method and Description |
---|---|
static LoggingEvent |
debug(Map<String,String> mdc,
org.slf4j.Marker marker,
String message,
Object... arguments) |
static LoggingEvent |
debug(Map<String,String> mdc,
org.slf4j.Marker marker,
Throwable throwable,
String message,
Object... arguments) |
static LoggingEvent |
debug(Map<String,String> mdc,
String message,
Object... arguments) |
static LoggingEvent |
debug(Map<String,String> mdc,
Throwable throwable,
String message,
Object... arguments) |
static LoggingEvent |
debug(org.slf4j.Marker marker,
String message,
Object... arguments) |
static LoggingEvent |
debug(org.slf4j.Marker marker,
Throwable throwable,
String message,
Object... arguments) |
static LoggingEvent |
debug(String message,
Object... arguments) |
static LoggingEvent |
debug(Throwable throwable,
String message,
Object... arguments) |
boolean |
equals(Object o) |
static LoggingEvent |
error(Map<String,String> mdc,
org.slf4j.Marker marker,
String message,
Object... arguments) |
static LoggingEvent |
error(Map<String,String> mdc,
org.slf4j.Marker marker,
Throwable throwable,
String message,
Object... arguments) |
static LoggingEvent |
error(Map<String,String> mdc,
String message,
Object... arguments) |
static LoggingEvent |
error(Map<String,String> mdc,
Throwable throwable,
String message,
Object... arguments) |
static LoggingEvent |
error(org.slf4j.Marker marker,
String message,
Object... arguments) |
static LoggingEvent |
error(org.slf4j.Marker marker,
Throwable throwable,
String message,
Object... arguments) |
static LoggingEvent |
error(String message,
Object... arguments) |
static LoggingEvent |
error(Throwable throwable,
String message,
Object... arguments) |
static LoggingEvent |
fromSlf4jEvent(org.slf4j.event.LoggingEvent event)
Create a
LoggingEvent from an SLF4J LoggingEvent . |
static LoggingEvent |
fromSlf4jEvent(org.slf4j.event.LoggingEvent event,
Map<String,String> mdc)
Create a
LoggingEvent with an MDC from an SLF4J LoggingEvent . |
List<Object> |
getArguments()
Get the arguments to the event.
|
TestLogger |
getCreatingLogger() |
String |
getFormattedMessage() |
List<org.slf4j.event.KeyValuePair> |
getKeyValuePairs()
Get the key/value pairs of the event.
|
org.slf4j.event.Level |
getLevel() |
Optional<org.slf4j.Marker> |
getMarker()
Deprecated.
As events created using the SLF4J fluent API can contain multiple markers, this
method is deprecated in favor of
getMarkers() . |
List<org.slf4j.Marker> |
getMarkers()
Get the markers of the event.
|
SortedMap<String,String> |
getMdc()
Get the MDC of the event.
|
String |
getMessage() |
ClassLoader |
getThreadContextClassLoader() |
String |
getThreadName() |
Optional<Throwable> |
getThrowable() |
Instant |
getTimestamp() |
int |
hashCode() |
static LoggingEvent |
info(Map<String,String> mdc,
org.slf4j.Marker marker,
String message,
Object... arguments) |
static LoggingEvent |
info(Map<String,String> mdc,
org.slf4j.Marker marker,
Throwable throwable,
String message,
Object... arguments) |
static LoggingEvent |
info(Map<String,String> mdc,
String message,
Object... arguments) |
static LoggingEvent |
info(Map<String,String> mdc,
Throwable throwable,
String message,
Object... arguments) |
static LoggingEvent |
info(org.slf4j.Marker marker,
String message,
Object... arguments) |
static LoggingEvent |
info(org.slf4j.Marker marker,
Throwable throwable,
String message,
Object... arguments) |
static LoggingEvent |
info(String message,
Object... arguments) |
static LoggingEvent |
info(Throwable throwable,
String message,
Object... arguments) |
String |
toString() |
static LoggingEvent |
trace(Map<String,String> mdc,
org.slf4j.Marker marker,
String message,
Object... arguments) |
static LoggingEvent |
trace(Map<String,String> mdc,
org.slf4j.Marker marker,
Throwable throwable,
String message,
Object... arguments) |
static LoggingEvent |
trace(Map<String,String> mdc,
String message,
Object... arguments) |
static LoggingEvent |
trace(Map<String,String> mdc,
Throwable throwable,
String message,
Object... arguments) |
static LoggingEvent |
trace(org.slf4j.Marker marker,
String message,
Object... arguments) |
static LoggingEvent |
trace(org.slf4j.Marker marker,
Throwable throwable,
String message,
Object... arguments) |
static LoggingEvent |
trace(String message,
Object... arguments) |
static LoggingEvent |
trace(Throwable throwable,
String message,
Object... arguments) |
static LoggingEvent |
warn(Map<String,String> mdc,
org.slf4j.Marker marker,
String message,
Object... arguments) |
static LoggingEvent |
warn(Map<String,String> mdc,
org.slf4j.Marker marker,
Throwable throwable,
String message,
Object... arguments) |
static LoggingEvent |
warn(Map<String,String> mdc,
String message,
Object... arguments) |
static LoggingEvent |
warn(Map<String,String> mdc,
Throwable throwable,
String message,
Object... arguments) |
static LoggingEvent |
warn(org.slf4j.Marker marker,
String message,
Object... arguments) |
static LoggingEvent |
warn(org.slf4j.Marker marker,
Throwable throwable,
String message,
Object... arguments) |
static LoggingEvent |
warn(String message,
Object... arguments) |
static LoggingEvent |
warn(Throwable throwable,
String message,
Object... arguments) |
public LoggingEvent(org.slf4j.event.Level level, Throwable throwable, String message, Object... arguments)
public LoggingEvent(org.slf4j.event.Level level, org.slf4j.Marker marker, String message, Object... arguments)
public LoggingEvent(org.slf4j.event.Level level, org.slf4j.Marker marker, Throwable throwable, String message, Object... arguments)
public LoggingEvent(org.slf4j.event.Level level, Map<String,String> mdc, String message, Object... arguments)
public LoggingEvent(org.slf4j.event.Level level, Map<String,String> mdc, Throwable throwable, String message, Object... arguments)
public LoggingEvent(org.slf4j.event.Level level, Map<String,String> mdc, org.slf4j.Marker marker, String message, Object... arguments)
public static LoggingEvent trace(String message, Object... arguments)
public static LoggingEvent trace(Throwable throwable, String message, Object... arguments)
public static LoggingEvent trace(org.slf4j.Marker marker, String message, Object... arguments)
public static LoggingEvent trace(org.slf4j.Marker marker, Throwable throwable, String message, Object... arguments)
public static LoggingEvent trace(Map<String,String> mdc, Throwable throwable, String message, Object... arguments)
public static LoggingEvent trace(Map<String,String> mdc, org.slf4j.Marker marker, String message, Object... arguments)
public static LoggingEvent trace(Map<String,String> mdc, org.slf4j.Marker marker, Throwable throwable, String message, Object... arguments)
public static LoggingEvent debug(String message, Object... arguments)
public static LoggingEvent debug(Throwable throwable, String message, Object... arguments)
public static LoggingEvent debug(org.slf4j.Marker marker, String message, Object... arguments)
public static LoggingEvent debug(org.slf4j.Marker marker, Throwable throwable, String message, Object... arguments)
public static LoggingEvent debug(Map<String,String> mdc, Throwable throwable, String message, Object... arguments)
public static LoggingEvent debug(Map<String,String> mdc, org.slf4j.Marker marker, String message, Object... arguments)
public static LoggingEvent debug(Map<String,String> mdc, org.slf4j.Marker marker, Throwable throwable, String message, Object... arguments)
public static LoggingEvent info(String message, Object... arguments)
public static LoggingEvent info(Throwable throwable, String message, Object... arguments)
public static LoggingEvent info(org.slf4j.Marker marker, String message, Object... arguments)
public static LoggingEvent info(org.slf4j.Marker marker, Throwable throwable, String message, Object... arguments)
public static LoggingEvent info(Map<String,String> mdc, Throwable throwable, String message, Object... arguments)
public static LoggingEvent info(Map<String,String> mdc, org.slf4j.Marker marker, String message, Object... arguments)
public static LoggingEvent info(Map<String,String> mdc, org.slf4j.Marker marker, Throwable throwable, String message, Object... arguments)
public static LoggingEvent warn(String message, Object... arguments)
public static LoggingEvent warn(Throwable throwable, String message, Object... arguments)
public static LoggingEvent warn(org.slf4j.Marker marker, String message, Object... arguments)
public static LoggingEvent warn(org.slf4j.Marker marker, Throwable throwable, String message, Object... arguments)
public static LoggingEvent warn(Map<String,String> mdc, Throwable throwable, String message, Object... arguments)
public static LoggingEvent warn(Map<String,String> mdc, org.slf4j.Marker marker, String message, Object... arguments)
public static LoggingEvent warn(Map<String,String> mdc, org.slf4j.Marker marker, Throwable throwable, String message, Object... arguments)
public static LoggingEvent error(String message, Object... arguments)
public static LoggingEvent error(Throwable throwable, String message, Object... arguments)
public static LoggingEvent error(org.slf4j.Marker marker, String message, Object... arguments)
public static LoggingEvent error(org.slf4j.Marker marker, Throwable throwable, String message, Object... arguments)
public static LoggingEvent error(Map<String,String> mdc, Throwable throwable, String message, Object... arguments)
public static LoggingEvent error(Map<String,String> mdc, org.slf4j.Marker marker, String message, Object... arguments)
public static LoggingEvent error(Map<String,String> mdc, org.slf4j.Marker marker, Throwable throwable, String message, Object... arguments)
public static LoggingEvent fromSlf4jEvent(org.slf4j.event.LoggingEvent event)
LoggingEvent
from an SLF4J LoggingEvent
.public static LoggingEvent fromSlf4jEvent(org.slf4j.event.LoggingEvent event, Map<String,String> mdc)
LoggingEvent
with an MDC from an SLF4J LoggingEvent
.public org.slf4j.event.Level getLevel()
public SortedMap<String,String> getMdc()
TestLogger
, this is an unmodifiable
copy of the MDC of the thread when the event was created. For events constructed directly, this
is unmodifiable copy of the MDC passed to the constructor, if any. If no MDC was used for
construction, the copy is an empty map. The copy is a SortedMap
, in order to make it
easier to spot discrepancies in case an assertion fails. Natural ordering of the keys is used.@Deprecated public Optional<org.slf4j.Marker> getMarker()
getMarkers()
.IllegalStateException
- if the event has more than one marker.public List<org.slf4j.Marker> getMarkers()
public List<org.slf4j.event.KeyValuePair> getKeyValuePairs()
public String getMessage()
public List<Object> getArguments()
public TestLogger getCreatingLogger()
IllegalStateException
- if this logging event was not created by a loggerpublic Instant getTimestamp()
public String getThreadName()
public ClassLoader getThreadContextClassLoader()
public String getFormattedMessage()
Copyright © 2023. All rights reserved.