Skip to content

A simple log4j based logger for TestNG tests and configuration methods

License

Notifications You must be signed in to change notification settings

RationaleEmotions/log4t

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A simple log4j based logger for TestNG tests and configuration methods

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages