Reg. getName() method

Hi,

I tried your code to get the current loggers in Log4j (http://www.toolsqa.com/selenium-webdriver/log4j-logmanager/).

However, I am not able to get the correct information.

logger3.info(“Logger name is “ + loggers.nextElement().getName());  –> Seems to be incorrect as  getName() is not listed.

I tried the following –
logger3.info(“Logger name is “ + loggers.nextElement().getName());

and the output is as given below:

0 [main] INFO Logger1 – This is logger 1
1 [main] INFO Logger2 – This is logger 2
1 [main] INFO Logger3 – This is logger 3
2 [main] INFO Logger3 – Logger name is org.apache.log4j.Logger
2 [main] INFO Logger3 – Logger name is org.apache.log4j.Logger
2 [main] INFO Logger3 – Logger name is org.apache.log4j.Logger

Is this the correct output ?

rrnaik Default Asked on October 26, 2015 in Selenium WebDriver.
Add Comment
1 Answer(s)

2 [main] INFO Logger3 – Logger name is org.apache.log4j.Logger
2 [main] INFO Logger3 – Logger name is org.apache.log4j.Logger
2 [main] INFO Logger3 – Logger name is org.apache.log4j.Logger

are not expected. Can you post the complete code, try to make it minimalist to reproduce the problem

Virender

Virender Singh Professor Answered on November 2, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.