This week's book giveaway is in the Programmer Certification forum. We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Sounds like an additivity issue. If the specified logger and the root logger both log it you can end up with dups. You could try setting additivity to false on your logger. Log4j manual mentions additivity and has a link to API with the method setAdditivity().
I don't normally configure anything in code, have always used properties files. I tried coding exactly what you said and I didn't get duplicate messages; you may have other configuration elsewhere in your code (like for root logger?). I had to make a couple thing up and I added to the logPattern so I could see the timestamp, level, loggername.
[ March 11, 2005: Message edited by: Carol Enderlin ]
posted 14 years ago
I had tryed the additivity thingy, but that was not it.
As it turned out, when I made the Logger variable static, it worked Ok.
Previously every MDB instance had its own, Logger variable. I was under the impression, the getLogger(loggerName) , would return a singleton.
Guess I still dont really understand, why creating 2 different logger variables, and using one to log something, actually logs it twice.