public static Collection<Handler> addJavaNoOpLogger(){
  Collection<Handler> savedHnds=new ArrayList<>();
  Logger log=Logger.getLogger("");
  for (  Handler h : log.getHandlers()) {
    log.removeHandler(h);
    savedHnds.add(h);
  }
  ConsoleHandler hnd=new ConsoleHandler();
  hnd.setLevel(Level.OFF);
  log.addHandler(hnd);
  return savedHnds;
}

public static Collection < Handler > addJavaNoOpLogger ( ) { Collection < Handler > savedHnds = new ArrayList < > ( ) ; Logger log = Logger . getLogger ( "" ) ; for ( Handler h : log . getHandlers ( ) ) { log . removeHandler ( h ) ; savedHnds . add ( h ) ; } ConsoleHandler hnd = new ConsoleHandler ( ) ; hnd . setLevel ( Level . OFF ) ; log . addHandler ( hnd ) ; return savedHnds ; }
adds no - op console handler for root java logger .
