Index: JohnAshcroft.java =================================================================== --- JohnAshcroft.java (revision 21) +++ JohnAshcroft.java (working copy) @@ -72,7 +72,7 @@ if (isJUnitCall(stackTrace)) { if (t.getName().startsWith("AWT-")) { cantDoThat(CANT_USE_AWT, stackTrace); - } else { + } else if (!isLoggingRelated(stackTrace)) { cantDoThat(CANT_START_THREADS, stackTrace); } } @@ -118,7 +118,7 @@ public void checkRead(String file) { String stackTrace = getStackTrace(); - if (isJUnitCall(stackTrace) && !isClassLoaderRead(stackTrace)) { + if (isJUnitCall(stackTrace) && !isClassLoaderRead(stackTrace) && !isLoggingRelated(stackTrace)) { if (isJavaAwtCall(stackTrace)) { cantDoThat(CANT_USE_AWT, stackTrace); } else { @@ -152,6 +152,12 @@ } } + private boolean isLoggingRelated(String stackTrace) { + return stackTrace.indexOf("java.util.logging.LogManager") != -1 + || stackTrace.indexOf("LogFactory") != -1 + || stackTrace.indexOf("log4j") != -1; + } + private boolean isCompilerRun(String stackTrace) { return stackTrace.indexOf("java.lang.Compiler$1.run") != -1; }