Skip to content

Latest commit

 

History

History
36 lines (25 loc) · 1.33 KB

README.md

File metadata and controls

36 lines (25 loc) · 1.33 KB

Log4T

Stands for Logger for test methods.

Currently, this logger is hard-wired to be used only with log4j

Pre-requisites

  1. TestNG 7.4.0
  2. JDK8

Salient features

  • Always generates a log file on a per test method basis.
  • The logger does not take into account a test method with multiple invocations and a test method powered by a data provider.
  • Log file names are fully qualified class names along with the method name.
  • All logs are by default available in the logs directory.
  • Captures log messages generated ONLY by a test method.
  • Supports being invoked ONLY from within a @Test (or) @BeforeXXX|@AfterXXX methods.
  • Does not capture logs generated by API calls that the current test method makes.
  • The log file name of a test method is available as an attribute in its ITestResult object with a key named log4t.logs

How to use

Log4T.getLogger().info("testMethod1");

Customisation

In-case, you would like to customize the directory or the pattern etc., following would need to be done

  1. Implement the interface com.rationaleemotions.IAppenderInfo
  2. Create a folder META-INF/services in your resources directory.
  3. Create a file named com.rationaleemotions.IAppenderInfo in the newly created directory.
  4. Refer the fully qualified class name of your implementation from (1) into this file.