private void allesLoggingAus() { List<Logger> loggers = Collections.<Logger>list(LogManager.getCurrentLoggers()); loggers.add(LogManager.getRootLogger()); for (Logger logger : loggers) { if (logger.getName().startsWith("my.company")) { //System.out.println("--- logger: " + logger.getName()); logger.setLevel(Level.OFF); } } originalOut = System.out; originalErr = System.err; ByteArrayOutputStream collectedOut = new ByteArrayOutputStream(); ByteArrayOutputStream collectedErr = new ByteArrayOutputStream(); System.setOut(new PrintStream(collectedOut)); System.setErr(new PrintStream(collectedErr)); } private void allesLoggingAn() { List<Logger> loggers = Collections.<Logger>list(LogManager.getCurrentLoggers()); loggers.add(LogManager.getRootLogger()); for (Logger logger : loggers) { if (logger.getName().startsWith("my.company")) { logger.setLevel(Level.INFO); } } System.setOut(originalOut); System.setErr(originalErr); }