Log4j

  • 25
    Mar

    Utility to load all properties files, located in a specified folder

    Following code snippet demonstrates, how to load all property files into memory: ——————————————————————————— Pre-requisite: ————— There exists a folder on local file system which contains files with extension “PROPERTIES”...

    Read More
  • 19
    Oct

    Standalone extent report for a TestNG testcase (Extent Reports < 3.0 ver)

    import java.io.File; import org.testng.Assert; import org.testng.ITestResult; import org.testng.SkipException; import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.relevantcodes.extentreports.ExtentReports; import com.relevantcodes.extentreports.ExtentTest; import com.relevantcodes.extentreports.LogStatus; import libraries.*; public class ExtentReportsClass { ExtentReports...

    Read More
  • 22
    Aug

    Generate HTML / XML logs with log4j

    In order to generate log4j logs in XML or HTML format one can configure log4j.properties file with following properties: log4j.rootLogger=DEBUG, CA log4j.appender.CA=org.apache.log4j.ConsoleAppender log4j.appender.CA.layout=org.apache.log4j.HTMLLayout log4j.appender.CA.layout.ConversionPattern=%-4r [%t] %-5p %c %x –...

    Read More
  • 22
    Aug

    Configure log4j to write logs to local filesystem – FileAppender

    Three main components that needs to be configured in log4j.properties file are: 1. logger => log messages. 2. appender => specifies the output destination like console or a file....

    Read More
  • 18
    Jul

    Log automation run results

    In order to collect information detailing timestamp of execution and steps performed during Automation execution, logging the steps is critical and can serve as a basis for tracking it...

    Read More