All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.katalon.kata.helper.LogHelper Maven / Gradle / Ivy

There is a newer version: 1.0.5
Show newest version
package com.katalon.kata.helper;

import ch.qos.logback.classic.LoggerContext;
import com.github.sbabcoc.logback.testng.ReporterAppender;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LogHelper {

    static {
        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
        ReporterAppender reporterAppender = new ReporterAppender();
        reporterAppender.setContext(lc);
        reporterAppender.start();
    }

    public static Logger getLogger() {


        final StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
    /*
     * stackTrace[0] is for Thread.currentThread().getStackTrace() stackTrace[1] is for this method log()
     */
        String className = stackTrace[2].getClassName();
        return LoggerFactory.getLogger(className);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy