There is no need to call you logger only from main, it is key based so you can call it from anywhere,
- Add log4j2 jar to your build path
- Create log4j2.xml file in your src path(else need to specify -Dlog4j2.configuration=file:///path)
- start using logger in your code by accessing using a unique key like
private static Logger logger= LogManager.getLogger("myLogger");
with following commands
logger.info() , logger.error(), logger.debug, logger.entry() etc...
for brief information:
Thanks,
Kavan
On Monday, December 22, 2014 2:20:08 PM UTC+5:30, Amoll Badgujar wrote:
will u please tell me how to add log4j file code in my selenium webdriver using java.
Structure is ..
auto
-src
- com.next.main
- com.next.task
i just wanted to add log4j file code in main method through main method i had call all my classes.
so thats why i just add in main().