Howdy, I use log4j as you all know ;) To observe good performance practices, I surround my logger.debug statements in if(logger.isDebugEnabled()) blocks. All works well.
I have many JUnit tests, and integrated unit test coverage reporting with Clover (http://www.thecortex.net/clover/). Let's say I'm testing class SomeObject, and the JUnit class is SomeObjectTester. In my tests, I want to exercise the logger.debug blocks as well for maximum coverage, so prior to starting the tests I do the following in the SomeObjectTester class: Logger someObjectLogger = Logger.getLogger(SomeObject.class.getName()); someObjectLogger.setLevel(Level.DEBUG); And that works fine, no problems, the debug blocks are exercised. However, because all the if(logger.isDebugEnabled()) checks are true, never false, I can never get 100% code coverage. So one solution would be to run all the tests twice, once with debug-level logging enabled for the tested class, and once with a higher level threshold. But that seems annoying, slow, not elegant. Has anyone run into this before, come up or can think of a different solution to getting 100% code coverage for this coding pattern? Yoav Shapira Millennium ChemInformatics This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]