Java Utililty Methods slf4j Logger

List of utility methods to do slf4j Logger

Description

The list of methods to do slf4j Logger are organized into topic(s).

Method

voiderror(Logger logger, Exception e)
error
logger.error(e.getMessage(), e);
voiderror(String errorMessage, Throwable e)
error
e.printStackTrace();
error.error(errorMessage, e);
voiderror(String msg, Throwable e)
error
StackTraceElement se = Thread.currentThread().getStackTrace()[2];
String clazzMethod = " " + se.getClassName() + "." + se.getMethodName() + "(" + se.getFileName() + ":"
        + se.getLineNumber() + ") ";
String log = clazzMethod + "   " + " MSG: " + msg;
logger.error(log, e);
voidExecptionLog(Logger log, String msg, Throwable e)
Execption Log
StringextractValue(String var)
This method will fetch and return the value of 'var' from system variables and if not found in system variables then in environment variables.
if (var != null) {
    if (!var.startsWith("${") || !var.endsWith("}")) {
        return null;
    var = var.replace("${", "");
    var = var.substring(0, var.length() - 1);
    if (var != null) {
        if (System.getProperty(var) != null) {
...
MarkerfindMarker(Marker marker, String name)
Find the marker with the given name in the given marker or its references
if (marker == null) {
    return null;
if (marker.getName().equals(name)) {
    return marker;
} else if (marker.hasReferences()) {
    Iterator<?> refs = marker.iterator();
    while (refs.hasNext()) {
...
Stringformat(final String pattern, final @Nullable Object... arguments)
format
return MessageFormatter.arrayFormat(pattern, arguments).getMessage();
Stringformat(String format, Object... args)
Returns a formatted string using SLF4J-style argument place holders.
return MessageFormatter.arrayFormat(format, args).getMessage();
Stringformat(String messagePattern, Object... args)
format
FormattingTuple formattingTuple = MessageFormatter.arrayFormat(messagePattern, args);
return formattingTuple.getMessage();
Loggerget(Class clazz)
get
return LoggerFactory.getLogger(clazz);