I would like to have the Log4j2 logging information available in the TestNG reports for all of the test cases.
TestNG uses a special logger class called Reporter.java that keeps track of the log output and saves it in its results XML.
In log4j it was possible to simply create an appender implementation that routes to Reporter and register it.
With the new Logger API in Log4j2 it has been difficult to find information on how to accomplish this. I have some information to get this done using Log4j but not with Log4j2.
add this in pom.xml
then you can use log.info or log.error etc...
From what I can tell you just need to implement a simple Appender. Something like: