Example usage for java.util.logging Level OFF

List of usage examples for java.util.logging Level OFF

Introduction

In this page you can find the example usage for java.util.logging Level OFF.

Prototype

Level OFF

To view the source code for java.util.logging Level OFF.

Click Source Link

Document

OFF is a special level that can be used to turn off logging.

Usage

From source file:org.javascool.compiler.JVSClassLoader.java

/**
 * Cherche une classe dans le classpath actuel et dans le rpertoire fournit au classloader
 *
 * @param className La classe  charger/*  w  w w.  j  a  va 2 s . c om*/
 * @return L'objet reprsentant une classe en Java
 * @throws ClassNotFoundException Dans le cas o aucune classe n'as pu tre trouv.
 */
@Override
public Class<?> findClass(String className) throws ClassNotFoundException {
    byte classByte[];
    Class<?> result;

    result = classes.get(className); // On vrifie qu'elle n'est pas dans le cache
    if (result != null) {
        return result;
    }

    try { // On cherche si c'est une classe systme
        return findSystemClass(className);
    } catch (Exception e) {
        Logger.getAnonymousLogger().log(Level.OFF, className + " n'est pas une classe systme");
    }

    try { // Ou qu'elle est dans le chargeur parent
        return JVSClassLoader.class.getClassLoader().loadClass(className);
    } catch (Exception e) {
        Logger.getAnonymousLogger().log(Level.OFF, className + " n'est pas une classe du chargeur parent");
    }

    try { // On regarde aprs si elle n'est pas chez nous.
          // On en cre le pointeur vers le fichier de la classe
        File clazz = FileUtils.getFile(location, decomposePathForAClass(className));
        if (!clazz.exists()) { // Si le fichier de la classe n'existe pas, alors on cre une erreur
            throw new FileNotFoundException("Le fichier : " + clazz.toString() + " n'existe pas");
        }
        // On lit le fichier
        classByte = FileUtils.readFileToByteArray(clazz);
        // On dfinit la classe
        result = defineClass(className, classByte, 0, classByte.length, null);
        // On la stocke en cache
        classes.put(className, result);
        // On retourne le rsultat
        return result;
    } catch (Exception e) {
        throw new ClassNotFoundException(e.getMessage(), e);
    }
    //
}

From source file:ffx.ui.LogHandler.java

/**
 * {@inheritDoc}//from   w  w w.  jav  a 2  s . c  o  m
 *
 * Publish a LogRecord.
 *
 * @since 1.0.
 */
@Override
public synchronized void publish(LogRecord record) {
    if (record.getLevel() == Level.OFF) {
        if (record.getMessage().toLowerCase().contains("algorithm failure:")) {
            mainPanel.setExitType(MainPanel.ExitStatus.ALGORITHM_FAILURE);
        }
        return;
    }
    /**
     * Check if the record is loggable and that we have not already
     * encountered a fatal error.
     */
    if (!isLoggable(record) || fatal) {
        return;
    }
    String msg;
    try {
        msg = getFormatter().format(record);
    } catch (Exception e) {
        /**
         * We don't want to throw an exception here, but we report the
         * exception to any registered ErrorManager.
         */
        reportError(null, e, ErrorManager.FORMAT_FAILURE);
        return;
    }
    try {
        if (record.getLevel() == Level.SEVERE) {
            fatal = true;
            System.err.println(msg);

            Throwable throwable = record.getThrown();
            if (throwable != null) {
                System.err.println(String.format(" Exception %s logged.", throwable));
            }

            // If tryCatchSevere, and the throwable (if it exists) is not an Error, then...
            if (tryCatchSevere && (throwable == null || !(throwable instanceof Error))) {
                System.err.println(" Force Field X may not continue.");
                System.err.println(" Throwing new error...");
                fatal = false;
                if (throwable != null) {
                    throw new LoggerSevereError(throwable);
                } else {
                    throw new LoggerSevereError(" Unknown exception");
                }
            }

            System.err.println(" Force Field X will not continue.");
            System.err.println(" Shutting down...");
            flush();
            mainPanel.setExitType(MainPanel.ExitStatus.SEVERE);
            mainPanel.exit();
        }
        ModelingShell shell = null;
        if (mainPanel != null) {
            shell = mainPanel.getModelingShell();
        }

        if (!headless && shell != null) {
            shell.appendOutputNl(msg, shell.getResultStyle());
        } else {
            System.out.println(msg);
        }
    } catch (Exception e) {
        /**
         * We don't want to throw an exception here, but we report the
         * exception to any registered ErrorManager.
         */
        reportError(null, e, ErrorManager.WRITE_FAILURE);
    }
}

From source file:ch.puzzle.itc.mobiliar.business.generator.control.extracted.templates.TemplateProcessorBaseTest.java

protected void generate(AMWTemplateExceptionHandler templateExceptionHandler) throws IOException {
    CustomLogging.setup(Level.OFF);
    prepareWorkUnits(templateExceptionHandler);
    generateTemplates();//from   ww w .  j  a v a 2s.  c o  m
    writeFiles();
}

From source file:com.maxl.java.aips2sqlite.AllDown.java

public void downAipsXml(String file_medical_infos_xsd, String file_medical_infos_xml) {
    // http://download.swissmedicinfo.ch/
    boolean disp = false;
    ProgressBar pb = new ProgressBar();

    try {// www .ja  v a  2 s . co  m
        // Suppress all warnings!
        java.util.logging.Logger.getLogger("com.gargoylesoftware").setLevel(Level.OFF);
        // Start timer 
        long startTime = System.currentTimeMillis();
        if (disp)
            System.out.print("- Downloading AIPS file... ");
        else {
            pb.init("- Downloading AIPS file... ");
            pb.start();
        }

        WebClient webClient = new WebClient();
        // Get Swissmedic webpage
        HtmlPage currentPage = webClient.getPage("http://download.swissmedicinfo.ch/");
        // Simulate button click on "OK" button
        HtmlSubmitInput acceptBtn = currentPage.getElementByName("ctl00$MainContent$btnOK");
        currentPage = acceptBtn.click();
        // Simulate button click on "Yes" button
        acceptBtn = currentPage.getElementByName("ctl00$MainContent$BtnYes");

        InputStream is = acceptBtn.click().getWebResponse().getContentAsStream();

        File destination = new File("./downloads/tmp/aips.zip");
        FileUtils.copyInputStreamToFile(is, destination);

        is.close();
        webClient.closeAllWindows();

        if (!disp)
            pb.stopp();

        unzipToTemp(destination);

        // Copy file ./tmp/unzipped_preparations/Preparations.xml to ./xml/bag_preparations_xml.xml
        File folder = new File("./downloads/tmp/unzipped_tmp");
        File[] listOfFiles = folder.listFiles();
        for (int i = 0; i < listOfFiles.length; ++i) {
            if (listOfFiles[i].isFile()) {
                String file = listOfFiles[i].getName();
                if (file.endsWith(".xml")) {
                    File src = new File("./downloads/tmp/unzipped_tmp/" + file);
                    File dst = new File(file_medical_infos_xml);
                    FileUtils.copyFile(src, dst);
                    // Stop timer 
                    long stopTime = System.currentTimeMillis();
                    System.out.println("\r- Downloading AIPS file... " + dst.length() / 1024 + " kB in "
                            + (stopTime - startTime) / 1000.0f + " sec");
                } else if (file.endsWith(".xsd")) {
                    File src = new File("./downloads/tmp/unzipped_tmp/" + file);
                    File dst = new File(file_medical_infos_xsd);
                    FileUtils.copyFile(src, dst);
                }
            }
        }

        // Delete folder ./tmp
        FileUtils.deleteDirectory(new File("./xml/tmp"));
    } catch (Exception e) {
        if (!disp)
            pb.stopp();
        System.err.println(" Exception: in 'downAipsXml'");
        e.printStackTrace();
        return;
    }
}

From source file:i.am.jiongxuan.deapk.Deapk.java

public boolean decodeResources() {
    System.out.println(">>> (1/5) Decompiling all resource files and smali files...");

    Logger.getLogger(AndrolibResources.class.getName()).setLevel(Level.OFF);
    Logger.getLogger(Androlib.class.getName()).setLevel(Level.OFF);
    ApkDecoder apkDecoder = new ApkDecoder();
    try {//from   w  ww .j  a v  a 2s .c  o m
        apkDecoder.setKeepBrokenResources(true);
        apkDecoder.setBaksmaliDebugMode(false);
        apkDecoder.setDebugMode(false);
        apkDecoder.setOutDir(mProjectDir);
        apkDecoder.setApkFile(mApkDir);
        apkDecoder.decode();
    } catch (AndrolibException e) {
        e.printStackTrace();
        return false;
    } catch (IOException e) {
        e.printStackTrace();
        return false;
    }

    if (mSmaliDir.exists()) {
        try {
            FileUtils.moveDirectory(mSmaliDir, mSrcDir);
        } catch (IOException e) {
            e.printStackTrace();
            // Rename the smali to src is not required, skip it if error.
        }
    }

    return true;
}

From source file:com.github.marcosalis.kraken.utils.http.DefaultHttpRequestsManager.java

private DefaultHttpRequestsManager() {
    final Level logLevel = DroidConfig.DEBUG ? Level.CONFIG : Level.OFF;
    Logger.getLogger(HttpTransport.class.getName()).setLevel(logLevel);
}

From source file:org.scantegrity.scanner.ScannerController.java

/**
 * Full Constructor. Most of the common options can be set.
 * //from  w  ww.j av a2 s.  c  o  m
 * @param p_log - The logging option.
 * @param p_binpath - The path to the binaries for the scannercontroller.
 * @param p_inpath - The path for input (image files). This should be a ramdisk!
 * @param p_outpath - Where output files should be stored.
 * @throws IOException
 * @throws InterruptedException
 */
public ScannerController(Logging p_log, String p_binpath, String p_inpath, String p_outpath, boolean p_delete) {
    if (p_binpath != null)
        c_binpath = p_binpath;
    if (p_outpath != null)
        setOutpath(p_outpath);
    if (p_inpath != null)
        setInpath(p_inpath);

    c_delete = p_delete;

    c_log = p_log;
    if (c_log == null) {
        Vector<String> l_out = new Vector<String>();
        l_out.add("");
        c_log = new Logging(l_out, -1, Level.OFF);
    }

    //Can I read/write to the paths?
    //....Assume we can read/write to ""
    try {
        File l_f = new File(p_binpath);
        if (!l_f.exists() || !l_f.isDirectory() || !l_f.canRead()) {
            p_binpath = "";
        }
    } catch (Exception l_e) {
        p_binpath = "";
    }
    if (p_binpath == "") {
        c_log.log(Level.WARNING, "Binary path is unusable: " + p_binpath);
    }
    //input path
    try {
        File l_f = new File(p_inpath);
        if (!l_f.exists() || !l_f.isDirectory() || !l_f.canRead()) {
            p_inpath = "";
        }
    } catch (Exception l_e) {
        p_inpath = "";
    }
    if (p_inpath == "") {
        c_log.log(Level.WARNING, "In path is unusable: " + p_inpath);
    }

    //output path
    try {
        File l_f = new File(p_outpath);
        if (!l_f.exists() || !l_f.isDirectory() || !l_f.canWrite()) {
            p_outpath = "";
        }
    } catch (Exception l_e) {
        p_outpath = "";
    }
    if (p_outpath == "") {
        c_log.log(Level.WARNING, "Output path is unusable: " + p_outpath);
    }

    try {
        //Test to make sure the command works.
        Process l_p = Runtime.getRuntime().exec(c_binpath + c_scanimgcmd + " " + c_testopts);
        synchronized (this) {
            l_p.waitFor();
            if (l_p.exitValue() != 0) {
                String l_err = "Unable to open scanning program. Error: ";
                l_err += getErrorMsg(l_p);
                c_log.log(Level.SEVERE, l_err);
            } else {
                c_log.log(Level.INFO, "Scanner control initialized and working.");
            }

            closeProcess(l_p);
        }
    } catch (Exception l_e) {
        c_log.log(Level.SEVERE, "Unable to start scanning program!" + l_e.getMessage());
    }
}

From source file:br.unicamp.cst.util.MindViewer.java

/**
 * Creates new form WorldObjectViewer// www .  j  a  v  a  2 s .  c om
 */
public MindViewer(Mind mind, String windowName, List<Codelet> behavioralCodelets) {
    initComponents();
    setWO(mind);
    setWindowName(windowName);
    setBehavioralCodelets(behavioralCodelets);
    createTreeModelGUI(jspMindsEntities, getWog().getCodeRack().getAllCodelets(), windowName);
    setTitle(windowName);
    startMindEntitiesThread();
    buildMindModulePanels(mind);

    Logger.getLogger("ac.biu.nlp.nlp.engineml").setLevel(Level.OFF);
    Logger.getLogger("org.BIU.utils.logging.ExperimentLogger").setLevel(Level.OFF);
    Logger.getLogger("java.awt").setLevel(Level.OFF);
    Logger.getLogger("sun.awt").setLevel(Level.OFF);
    Logger.getLogger("javax.swing").setLevel(Level.OFF);

}

From source file:de.aeb.sqlscriptformater.SqlScriptFormater.java

/**
 * Constructor for parametric use.//  ww w .j  a  va  2s  .c o  m
 *
 * @param args String array containing the parameters in the right order.
 * @param verbose turns logging on or off.
 */
public SqlScriptFormater(String[] args, boolean verbose) {
    // for debugging
    if (verbose) {
        log.setLevel(Level.ALL);
    } else {
        log.setLevel(Level.OFF);
    }
    _parametersSet = extractArgs(args);
}

From source file:net.demilich.metastone.bahaviour.ModifiedMCTS.MCTSCritique.java

public MCTSCritique(String modelFile) {
    //System.err.println("someething new requested of me");
    //caffe_net./*from  w  w w  . java 2 s.  co  m*/

    if (caffe_net != null) {
        return;
    }

    this.modelFile = modelFile;
    modelFile = null;
    modelFile = "/home/dfreelan/dev/networks/hybrid.caffemodel";
    String paramFile = "/home/dfreelan/dev/networks/singleLayerExample.prototxt";
    //Caffe.set_mode(Caffe.CPU);

    try {
        //String str = FileUtils.readFileToString(new File(paramFile), "utf-8");
        ///System.err.println(str);
        if (modelFile != null) {
            Thread.sleep(new Random().nextInt(10000 + 1000));
            caffe_net = new FloatNet(paramFile, TEST);
            caffe_net.CopyTrainedLayersFrom(modelFile);
        }

    } catch (Exception e) {
        e.printStackTrace();
        System.exit(0);
    }
    java.util.logging.Logger.getLogger(caffe.class.getSimpleName()).setLevel(Level.OFF);
    ;
}