Package de.espirit.common.base
Class Logging
java.lang.Object
de.espirit.common.base.Logging
The Logging is used to log messages for a given class.
Each message is related to a specific log level and might be combined with a stack trace.
- Since:
- 4.2.38
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull Logger
Get theLogger
instance.static @NotNull MappedDiagnosticContext
Get theMappedDiagnosticContext
instance.static void
Initialization of theLogger
.static void
initMDC
(@Nullable MappedDiagnosticContext mdc) Initialization of theMappedDiagnosticContext
.static boolean
isDebugEnabled
(@NotNull Class<?> clazz) Check whether the DEBUG level is enabled for the given class.static boolean
isDebugEnabled
(@NotNull String name) Check whether the DEBUG level is enabled for the given logger name.static boolean
isInfoEnabled
(@NotNull Class<?> logger) Check whether the INFO level is enabled for the given class.static boolean
isInfoEnabled
(@NotNull String name) Check whether the INFO level is enabled for the given logger name.static boolean
isTraceEnabled
(@NotNull Class<?> clazz) Check whether the TRACE level is enabled for the given class.static boolean
isTraceEnabled
(@NotNull String name) Check whether the TRACE level is enabled for the given logger name.static boolean
isWarnEnabled
(@NotNull Class<?> logger) Check whether the WARN level is enabled for the given class.static boolean
isWarnEnabled
(@NotNull String name) Check whether the WARN level is enabled for the given logger name.static void
Checks first whether the DEBUG level is enabled for the given class.static void
Checks first whether the DEBUG level is enabled for the given class.static void
Logs the given error message for the given class.static void
Logs the error message and the stack trace which causes the message for the given class.static void
Logs the given fatal message for the given class.static void
Logs the fatal message and the stack trace which causes the message for the given class.static void
Checks first whether the INFO level is enabled for the given class.static void
Checks first whether the INFO level is enabled for the given class.static void
Checks first whether the TRACE level is enabled for the given class.static void
Checks first whether the TRACE level is enabled for the given class.static void
logWarning
(String message, @NotNull Class<?> logger) Checks first whether the WARN level is enabled for the given class.static void
logWarning
(String message, Throwable cause, @NotNull Class<?> logger) Checks first whether the WARN level is enabled for the given class.
-
Constructor Details
-
Logging
public Logging()
-
-
Method Details
-
isTraceEnabled
Check whether the TRACE level is enabled for the given class. This method can be used to prevent unnecessary expensive message creation if the level is not enabled.- Parameters:
clazz
- The class for which is checked if the TRACE level is enabled.- Returns:
- boolean: true if TRACE level is enabled, false if it is not enabled
- Since:
- 4.2.38
-
isTraceEnabled
Check whether the TRACE level is enabled for the given logger name. This method can be used to prevent unnecessary expensive message creation if the level is not enabled.- Parameters:
name
- The name of the logger for which is checked if the TRACE level is enabled.- Returns:
- boolean: true if TRACE level is enabled, false if it is not enabled
- Since:
- 5.2.230406
-
logTrace
Checks first whether the TRACE level is enabled for the given class. If so the message is logged.- Parameters:
message
- The message that should be logged.logger
- The class for which the message should be logged.- Since:
- 4.2.38
-
logTrace
public static void logTrace(@NotNull @NotNull String message, Throwable cause, @NotNull @NotNull Class<?> logger) Checks first whether the TRACE level is enabled for the given class. If so the message and the stack trace which causes the message are logged.- Parameters:
message
- The message that should be logged.cause
- The stack trace that causes the message.logger
- The class for which the message and the stack trace should be logged.- Since:
- 4.2.38
-
isDebugEnabled
Check whether the DEBUG level is enabled for the given class. This method can be used to prevent unnecessary expensive message creation if the level is not enabled.- Parameters:
clazz
- The class for which is checked if the DEBUG level is enabled.- Returns:
- boolean: true if DEBUG level is enabled, false if it is not enabled
- Since:
- 4.2.38
-
isDebugEnabled
Check whether the DEBUG level is enabled for the given logger name. This method can be used to prevent unnecessary expensive message creation if the level is not enabled.- Parameters:
name
- The name of the logger for which is checked if the DEBUG level is enabled.- Returns:
- boolean: true if DEBUG level is enabled, false if it is not enabled
- Since:
- 5.2.230406
-
logDebug
Checks first whether the DEBUG level is enabled for the given class. If so the message and the stack trace which causes the debug message are logged.- Parameters:
message
- The message that should be logged.cause
- The stack trace that causes the message.logger
- The class for which the message and the stack trace should be logged.- Since:
- 4.2.38
-
logDebug
Checks first whether the DEBUG level is enabled for the given class. If so the given message is logged.- Parameters:
message
- The message that should be logged.logger
- The class for which the message should be logged.- Since:
- 4.2.38
-
isInfoEnabled
Check whether the INFO level is enabled for the given class. This method can be used to prevent unnecessary expensive message creation if the level is not enabled.- Parameters:
logger
- The class for which is checked if the INFO level is enabled.- Returns:
- boolean: true if INFO level is enabled, false if it is not enabled
- Since:
- 4.2.38
-
isInfoEnabled
Check whether the INFO level is enabled for the given logger name. This method can be used to prevent unnecessary expensive message creation if the level is not enabled.- Parameters:
name
- The name of the logger for which is checked if the INFO level is enabled.- Returns:
- boolean: true if INFO level is enabled, false if it is not enabled
- Since:
- 5.2.230406
-
logInfo
Checks first whether the INFO level is enabled for the given class. If so the message and the stack trace which causes the information are logged.- Parameters:
message
- The message that should be logged.cause
- The stack trace that causes the message.logger
- The class for which the message and the stack trace should be logged.- Since:
- 4.2.38
-
logInfo
Checks first whether the INFO level is enabled for the given class. If so the given message is logged.- Parameters:
message
- The message that should be logged.logger
- The class for which the message should be logged.- Since:
- 4.2.38
-
isWarnEnabled
Check whether the WARN level is enabled for the given class. This method can be used to prevent unnecessary expensive message creation if the level is not enabled.- Parameters:
logger
- The class for which is checked if the WARN level is enabled.- Returns:
- boolean: true if WARN level is enabled, false if it is not enabled
- Since:
- 4.2.38
-
isWarnEnabled
Check whether the WARN level is enabled for the given logger name. This method can be used to prevent unnecessary expensive message creation if the level is not enabled.- Parameters:
name
- The name of the logger for which is checked if the WARN level is enabled.- Returns:
- boolean: true if WARN level is enabled, false if it is not enabled
- Since:
- 5.2.230406
-
logWarning
Checks first whether the WARN level is enabled for the given class. If so the message and the stack trace which causes the warning are logged.- Parameters:
message
- The message that should be logged.cause
- The stack trace that causes the message.logger
- The class for which the message and the stack trace should be logged.- Since:
- 4.2.38
-
logWarning
Checks first whether the WARN level is enabled for the given class. If so the message is logged.- Parameters:
message
- The message that should be logged.logger
- The class for that the message should be logged.- Since:
- 4.2.38
-
logError
Logs the error message and the stack trace which causes the message for the given class.- Parameters:
message
- The message that should be logged.cause
- The stack trace which causes the message.logger
- The class for which the message and the stack trace should be logged.- Since:
- 4.2.38
-
logError
Logs the given error message for the given class.- Parameters:
message
- The message that should be logged.logger
- The class for that the message should be logged.- Since:
- 4.2.38
-
logFatal
Logs the given fatal message for the given class.- Parameters:
message
- The message that should be logged.logger
- The class for that the message should be logged.- Since:
- 4.2.38
-
logFatal
public static void logFatal(@NotNull @NotNull String message, Throwable cause, @NotNull @NotNull Class<?> logger) Logs the fatal message and the stack trace which causes the message for the given class.- Parameters:
message
- The message that should be logged.cause
- The stack trace that causes the message.logger
- The class for that the message and the stack trace should be logged.- Since:
- 4.2.38
-
init
Initialization of theLogger
. If the given logger is null, a default value is used.- Parameters:
logger
- The given logger; could be null.- Since:
- 4.2.38
-
initMDC
Initialization of theMappedDiagnosticContext
. If the given MappedDiagnosticContext is null, a default value is used.- Parameters:
mdc
- The givenMappedDiagnosticContext
; could be null.- Since:
- 4.2.38
-
getLogger
Get theLogger
instance.- Returns:
Logger
- Since:
- 4.2.38
- See Also:
-
getMappedDiagnosticContext
Get theMappedDiagnosticContext
instance.- Returns:
MappedDiagnosticContext
- Since:
- 4.2.38
- See Also:
-