Class LogProbe
java.lang.Object
org.junit.rules.ExternalResource
de.hybris.platform.dataimportcommons.log.LogProbe
- All Implemented Interfaces:
org.junit.rules.TestRule,org.slf4j.Logger
public class LogProbe
extends org.junit.rules.ExternalResource
implements org.slf4j.Logger
A test rule for retrieving SLF4J
Loggers with adjusted log level compared to the default logback configuration
and asserting that an output has happened.-
Field Summary
Fields inherited from interface org.slf4j.Logger
ROOT_LOGGER_NAME -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafter()protected voidbefore()static LogProbeCreates a probe for the specified logger.voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidRetrieves all message logged by this probe.Retrieves all records logged by this probe.Retrieves all message logged at DEBUG level by this probe.Retrieves all message logged at DEBUG level with the stack trace.Retrieves all message logged at ERROR level by this probe.Retrieves all message logged at ERROR level with the stack trace.Retrieves all message logged at INFO level by this probe.Retrieves all message logged at INFO level with the stack trace.Retrieves all message logged at TRACE level by this probe.Retrieves all message logged at TRACE level with the stack trace.Retrieves all message logged at WARN level by this probe.Retrieves all message logged at WARN level with the stack trace.getName()voidvoidvoidvoidvoidvoidvoidvoidvoidvoidbooleanbooleanisDebugEnabled(org.slf4j.Marker marker) booleanbooleanisErrorEnabled(org.slf4j.Marker marker) booleanbooleanisInfoEnabled(org.slf4j.Marker marker) booleanbooleanisTraceEnabled(org.slf4j.Marker marker) booleanbooleanisWarnEnabled(org.slf4j.Marker marker) voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidwithLogLevel(LogLevel level) Sets log level for enabling/disabling output of certain messages.Methods inherited from class org.junit.rules.ExternalResource
apply
-
Method Details
-
create
Creates a probe for the specified logger.- Parameters:
type- type, for which a logger should be created.- Returns:
- a logger probe to be used in tests
-
withLogLevel
Sets log level for enabling/disabling output of certain messages.- Parameters:
level- level to apply for logging messages.- Returns:
- a probe with log level applied.
-
before
protected void before()- Overrides:
beforein classorg.junit.rules.ExternalResource
-
after
protected void after()- Overrides:
afterin classorg.junit.rules.ExternalResource
-
getAllLoggedRecords
Retrieves all records logged by this probe.- Returns:
- a list of records in the order they were logged regardless of their log level
-
getAllLoggedMessages
Retrieves all message logged by this probe.- Returns:
- a list of message logged regardless of their log level
-
getMessagesLoggedAtInfo
Retrieves all message logged at INFO level by this probe.- Returns:
- a list of message logged at INFO level regardless of whether they had stack trace printed or not.
-
getMessagesLoggedAtInfoWithStackTrace
Retrieves all message logged at INFO level with the stack trace.- Returns:
- only messages logged by this probe at INFO level, which had also a stack trace included.
-
getMessagesLoggedAtWarn
Retrieves all message logged at WARN level by this probe.- Returns:
- a list of message logged at WARN level regardless of whether they had stack trace printed or not.
-
getMessagesLoggedAtWarnWithStackTrace
Retrieves all message logged at WARN level with the stack trace.- Returns:
- only messages logged by this probe at WARN level, which had also a stack trace included.
-
getMessagesLoggedAtError
Retrieves all message logged at ERROR level by this probe.- Returns:
- a list of message logged at ERROR level regardless of whether they had stack trace printed or not.
-
getMessagesLoggedAtErrorWithStackTrace
Retrieves all message logged at ERROR level with the stack trace.- Returns:
- only messages logged by this probe at ERROR level, which had also a stack trace included.
-
getMessagesLoggedAtDebug
Retrieves all message logged at DEBUG level by this probe.- Returns:
- a list of message logged at DEBUG level regardless of whether they had stack trace printed or not.
-
getMessagesLoggedAtDebugWithStackTrace
Retrieves all message logged at DEBUG level with the stack trace.- Returns:
- only messages logged by this probe at DEBUG level, which had also a stack trace included.
-
getMessagesLoggedAtTrace
Retrieves all message logged at TRACE level by this probe.- Returns:
- a list of message logged at TRACE level regardless of whether they had stack trace printed or not.
-
getMessagesLoggedAtTraceWithStackTrace
Retrieves all message logged at TRACE level with the stack trace.- Returns:
- only messages logged by this probe at TRACE level, which had also a stack trace included.
-
getName
- Specified by:
getNamein interfaceorg.slf4j.Logger
-
isTraceEnabled
public boolean isTraceEnabled()- Specified by:
isTraceEnabledin interfaceorg.slf4j.Logger
-
trace
- Specified by:
tracein interfaceorg.slf4j.Logger
-
trace
- Specified by:
tracein interfaceorg.slf4j.Logger
-
trace
- Specified by:
tracein interfaceorg.slf4j.Logger
-
trace
- Specified by:
tracein interfaceorg.slf4j.Logger
-
trace
- Specified by:
tracein interfaceorg.slf4j.Logger
-
isTraceEnabled
public boolean isTraceEnabled(org.slf4j.Marker marker) - Specified by:
isTraceEnabledin interfaceorg.slf4j.Logger
-
trace
- Specified by:
tracein interfaceorg.slf4j.Logger
-
trace
- Specified by:
tracein interfaceorg.slf4j.Logger
-
trace
- Specified by:
tracein interfaceorg.slf4j.Logger
-
trace
- Specified by:
tracein interfaceorg.slf4j.Logger
-
trace
- Specified by:
tracein interfaceorg.slf4j.Logger
-
isDebugEnabled
public boolean isDebugEnabled()- Specified by:
isDebugEnabledin interfaceorg.slf4j.Logger
-
debug
- Specified by:
debugin interfaceorg.slf4j.Logger
-
debug
- Specified by:
debugin interfaceorg.slf4j.Logger
-
debug
- Specified by:
debugin interfaceorg.slf4j.Logger
-
debug
- Specified by:
debugin interfaceorg.slf4j.Logger
-
debug
- Specified by:
debugin interfaceorg.slf4j.Logger
-
isDebugEnabled
public boolean isDebugEnabled(org.slf4j.Marker marker) - Specified by:
isDebugEnabledin interfaceorg.slf4j.Logger
-
debug
- Specified by:
debugin interfaceorg.slf4j.Logger
-
debug
- Specified by:
debugin interfaceorg.slf4j.Logger
-
debug
- Specified by:
debugin interfaceorg.slf4j.Logger
-
debug
- Specified by:
debugin interfaceorg.slf4j.Logger
-
debug
- Specified by:
debugin interfaceorg.slf4j.Logger
-
isInfoEnabled
public boolean isInfoEnabled()- Specified by:
isInfoEnabledin interfaceorg.slf4j.Logger
-
info
- Specified by:
infoin interfaceorg.slf4j.Logger
-
info
- Specified by:
infoin interfaceorg.slf4j.Logger
-
info
- Specified by:
infoin interfaceorg.slf4j.Logger
-
info
- Specified by:
infoin interfaceorg.slf4j.Logger
-
info
- Specified by:
infoin interfaceorg.slf4j.Logger
-
isInfoEnabled
public boolean isInfoEnabled(org.slf4j.Marker marker) - Specified by:
isInfoEnabledin interfaceorg.slf4j.Logger
-
info
- Specified by:
infoin interfaceorg.slf4j.Logger
-
info
- Specified by:
infoin interfaceorg.slf4j.Logger
-
info
- Specified by:
infoin interfaceorg.slf4j.Logger
-
info
- Specified by:
infoin interfaceorg.slf4j.Logger
-
info
- Specified by:
infoin interfaceorg.slf4j.Logger
-
isWarnEnabled
public boolean isWarnEnabled()- Specified by:
isWarnEnabledin interfaceorg.slf4j.Logger
-
warn
- Specified by:
warnin interfaceorg.slf4j.Logger
-
warn
- Specified by:
warnin interfaceorg.slf4j.Logger
-
warn
- Specified by:
warnin interfaceorg.slf4j.Logger
-
warn
- Specified by:
warnin interfaceorg.slf4j.Logger
-
warn
- Specified by:
warnin interfaceorg.slf4j.Logger
-
isWarnEnabled
public boolean isWarnEnabled(org.slf4j.Marker marker) - Specified by:
isWarnEnabledin interfaceorg.slf4j.Logger
-
warn
- Specified by:
warnin interfaceorg.slf4j.Logger
-
warn
- Specified by:
warnin interfaceorg.slf4j.Logger
-
warn
- Specified by:
warnin interfaceorg.slf4j.Logger
-
warn
- Specified by:
warnin interfaceorg.slf4j.Logger
-
warn
- Specified by:
warnin interfaceorg.slf4j.Logger
-
isErrorEnabled
public boolean isErrorEnabled()- Specified by:
isErrorEnabledin interfaceorg.slf4j.Logger
-
error
- Specified by:
errorin interfaceorg.slf4j.Logger
-
error
- Specified by:
errorin interfaceorg.slf4j.Logger
-
error
- Specified by:
errorin interfaceorg.slf4j.Logger
-
error
- Specified by:
errorin interfaceorg.slf4j.Logger
-
error
- Specified by:
errorin interfaceorg.slf4j.Logger
-
isErrorEnabled
public boolean isErrorEnabled(org.slf4j.Marker marker) - Specified by:
isErrorEnabledin interfaceorg.slf4j.Logger
-
error
- Specified by:
errorin interfaceorg.slf4j.Logger
-
error
- Specified by:
errorin interfaceorg.slf4j.Logger
-
error
- Specified by:
errorin interfaceorg.slf4j.Logger
-
error
- Specified by:
errorin interfaceorg.slf4j.Logger
-
error
- Specified by:
errorin interfaceorg.slf4j.Logger
-