public void preprocess(Run run) { File logFile = new File(getRunDir(run), "genetik.log"); try { SimpleFileHandler fh = new SimpleFileHandler(logFile); fh.setFormatter(new CompactFormatter()); Logger logger = Logger.getLogger(GenetikConstants.LOGGER); logger.setLevel(Level.INFO); logger.setUseParentHandlers(false); Handler handlers[] = logger.getHandlers(); logger.addHandler(fh); for (Handler h : handlers) { logger.removeHandler(h); if (h instanceof SimpleFileHandler) h.close(); // close our old one } } catch (Exception exp) { throw new IllegalArgumentException( "Unable to create log file at " + logFile.getAbsolutePath()); } super.preprocess(run); }
/** Set up reflection methods required by the loader */ @SuppressWarnings("unchecked") private boolean prepareLoader() { try { // addURL method is used by the class loader to mAddUrl = URLClassLoader.class.getDeclaredMethod("addURL", URL.class); mAddUrl.setAccessible(true); Formatter minecraftLogFormatter = null; try { Class<? extends Formatter> formatterClass = (Class<? extends Formatter>) Minecraft.class .getClassLoader() .loadClass( ModUtilities.getObfuscatedFieldName( "net.minecraft.src.ConsoleLogFormatter", "em")); Constructor<? extends Formatter> defaultConstructor = formatterClass.getDeclaredConstructor(); defaultConstructor.setAccessible(true); minecraftLogFormatter = defaultConstructor.newInstance(); } catch (Exception ex) { ConsoleLogManager.init(); minecraftLogFormatter = ConsoleLogManager.loggerLogManager.getHandlers()[0].getFormatter(); } logger.setUseParentHandlers(false); StreamHandler consoleHandler = new ConsoleHandler(); if (minecraftLogFormatter != null) consoleHandler.setFormatter(minecraftLogFormatter); logger.addHandler(consoleHandler); FileHandler logFileHandler = new FileHandler( new File(Minecraft.getMinecraftDir(), "LiteLoader.txt").getAbsolutePath()); if (minecraftLogFormatter != null) logFileHandler.setFormatter(minecraftLogFormatter); logger.addHandler(logFileHandler); } catch (Throwable th) { logger.log(Level.SEVERE, "Error initialising LiteLoader", th); return false; } return true; }
public UkkonenSuffixTree() { logger = Logger.getLogger( "edu.psu.compbio.seqcode.gse.projects.chipseq.assembler.UkkonenSuffixTree"); isLogging = true; minLogLevel = Level.SEVERE; logger.setFilter(new LoggingFilter()); logger.addHandler(new LoggingHandler(System.err, false)); logger.setUseParentHandlers(false); logger.setLevel(Level.SEVERE); logger.log(Level.FINE, "Logger setup complete."); strings = new Vector<TreeString>(); terminal = '$'; root = new TreeNode(null); totalStringEdges = new Vector<TreeEdge>(); extState = null; }