This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Created attachment 107612 [details] Proposed patch, minus apichanges NbTestCase.logLevel can be useful - show diagnostics only if the test actually fails, otherwise shut up. Yet typically you do not want to get log messages from everything in the JVM. Some AWT classes are quite chatty, and org.openide.util.Mutex dumps stack traces at FINE every time you use it. The real logs from your tested code can get hidden in the mess; in fact the log is truncated around 20k, so your own logs can actually be deleted in favor of irrelevant messages. The workaround is to turn of the root logger and turn on your own logger. But this is clumsy and error prone - you need to know how to make those calls and when (setUp?); and your own Logger you set to ALL must be held statically or it could be reset (FindBugs: LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE). The attached patch introduces a convenience method logRoot that takes care of these issues for the common case that you are only interested in messages from a certain class (or package or package subtree).
Seems good.
core-main #207f7bb76b55
Integrated into 'main-golden', will be available in build *201105060000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/207f7bb76b55 User: Jesse Glick <jglick@netbeans.org> Log: #197572: NbTestCase.logRoot may be used to refine logLevel to capture logs only from a certain part of the code.