Reputation: 519
private static final Logger logger = Logger.getLogger(filename.class);
logger.debug("logger" + element);
this line is printing twice and some times more..
this prints as
logger 123
logger 123
(on different lines)
Upvotes: 1
Views: 1751
Reputation: 3
try
BasicConfigurator.resetConfiguration()
after BasicConfigurator.configure() in the method that uses logger
Upvotes: 0
Reputation: 24134
I suspect if multiple loggers are qualifying for this class (where the appender configured for these qualifying loggers should be similar) and each one is printing the message.
A look at your log4j configuration file would help.
Upvotes: 1