Java slf4j Logger testLogError(String errorMessage, Exception ex)

Here you can find the source of testLogError(String errorMessage, Exception ex)

Description

test Log Error

License

Apache License

Declaration

public static void testLogError(String errorMessage, Exception ex) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Main {
    public static Logger testLog = LoggerFactory.getLogger("test_logger");
    public static boolean isPrintStackTrace = true;

    public static void testLogError(String errorMessage, Exception ex) {
        if (testLog != null) {
            testLog.error(errorMessage);
        }//from   w w w  .  j a  v  a 2s  . c o  m

        if (isPrintStackTrace && ex != null && testLog != null) {
            testLog.error(ex.getMessage(), ex);
        }
    }
}

Related

  1. sleepMs(Logger logger, long timeMs)
  2. stacktrace(Logger log, Throwable t)
  3. startTestLogging(String name)
  4. stopTestLogging()
  5. stringifyStackTrace(Exception e)
  6. traceCall(Class objectClass)
  7. traceLog(final Logger log, final String logMethodName, String logMsg)
  8. warn(Logger log, Object... args)
  9. warn(String format, Object... arguments)