Example usage for java.util.logging Level SEVERE

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

Introduction

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

Prototype

Level SEVERE

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

Click Source Link

Document

SEVERE is a message level indicating a serious failure.

Usage

From source file:Trabalho.HistogramaHSB.java

public static void main(String[] args) throws IOException {
    EventQueue.invokeLater(() -> {
        try {//from  w  w w.  j  a v  a 2  s .co m
            new HistogramaHSB().mostraTela();
        } catch (IOException ex) {
            Logger.getLogger(HistogramaHSB.class.getName()).log(Level.SEVERE, null, ex);
        }

    });
}

From source file:di.uniba.it.tee2.gui.TEEgui.java

/**
 * @param args the command line arguments
 *//*  w  w w. j  ava2  s . com*/
public static void main(String args[]) {

    try {
        CommandLine cmd = cmdParser.parse(options, args);
        if (cmd.hasOption("l") && cmd.hasOption("d")) {
            language = cmd.getOptionValue("l");
            maindir = cmd.getOptionValue("d");
            /* Set the Nimbus look and feel */
            //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
            /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
                 * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
                 */
            try {
                for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager
                        .getInstalledLookAndFeels()) {
                    if ("Nimbus".equals(info.getName())) {
                        javax.swing.UIManager.setLookAndFeel(info.getClassName());
                        break;
                    }
                }
            } catch (ClassNotFoundException ex) {
                java.util.logging.Logger.getLogger(TEEgui.class.getName()).log(java.util.logging.Level.SEVERE,
                        null, ex);
            } catch (InstantiationException ex) {
                java.util.logging.Logger.getLogger(TEEgui.class.getName()).log(java.util.logging.Level.SEVERE,
                        null, ex);
            } catch (IllegalAccessException ex) {
                java.util.logging.Logger.getLogger(TEEgui.class.getName()).log(java.util.logging.Level.SEVERE,
                        null, ex);
            } catch (javax.swing.UnsupportedLookAndFeelException ex) {
                java.util.logging.Logger.getLogger(TEEgui.class.getName()).log(java.util.logging.Level.SEVERE,
                        null, ex);
            }
            //</editor-fold>

            /* Create and display the form */
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    try {
                        new TEEgui().setVisible(true);
                    } catch (IOException ex) {
                        Logger.getLogger(TEEgui.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            });
        } else {
            HelpFormatter helpFormatter = new HelpFormatter();
            helpFormatter.printHelp("Run GUI", options, true);
        }
    } catch (ParseException ex) {
        Logger.getLogger(TEEgui.class.getName()).log(Level.SEVERE, null, ex);
    }
    //</editor-fold>
}

From source file:de.uni_koblenz.jgralab.utilities.greqlserver.GReQLConsole.java

/**
 * Performs some queries, extend this method to perform more queries
 * //from   www  .  j av a 2s  . c  om
 * @param args
 */
public static void main(String[] args) {
    try {
        CommandLine comLine = processCommandLineOptions(args);
        assert comLine != null;

        String queryFile = comLine.getOptionValue("q");
        String graphFile = comLine.getOptionValue("g");
        boolean loadSchema = comLine.hasOption("s");

        JGraLab.setLogLevel(Level.SEVERE);
        GReQLConsole console = new GReQLConsole(graphFile, loadSchema, comLine.hasOption('v'));
        Object result = console.performQuery(new File(queryFile));

        if (comLine.hasOption("o")) {
            console.saveResultToFile(result, comLine.getOptionValue("o"), comLine.getOptionValue('t'));
        } else {
            System.out.println("Result: " + result);
        }
    } catch (Exception e) {
        if (e instanceof ParsingException) {
            ParsingException ex = (ParsingException) e;
            System.err.println("##exception=ParsingException");
            System.err.println("##offset=" + ex.getOffset());
            System.err.println("##length=" + ex.getLength());
        } else if (e instanceof QuerySourceException) {
            QuerySourceException ex = (QuerySourceException) e;
            System.err.println("##exception=" + ex.getClass().getSimpleName());
            System.err.println("##offset=" + ex.getOffset());
            System.err.println("##length=" + ex.getLength());
        }
        e.printStackTrace();
        System.exit(1); // exit with non-zero exit code
    }
}

From source file:guardar.en.base.de.datos.MainServidor.java

public static void main(String[] args)
        throws ParserConfigurationException, SAXException, IOException, ClassNotFoundException {

    Mongo mongo = new Mongo("localhost", 27017);

    // nombre de la base de datos
    DB database = mongo.getDB("paginas");
    // coleccion de la db
    DBCollection collection = database.getCollection("indice");
    DBCollection collection_textos = database.getCollection("tabla");
    ArrayList<String> lista_textos = new ArrayList();

    try {//  ww  w  .j av  a2  s. c  o m
        ServerSocket servidor = new ServerSocket(4545); // Crear un servidor en pausa hasta que un cliente llegue.
        while (true) {
            String aux = new String();
            lista_textos.clear();
            Socket clienteNuevo = servidor.accept();// Si llega se acepta.
            // Queda en pausa otra vez hasta que un objeto llegue.
            ObjectInputStream entrada = new ObjectInputStream(clienteNuevo.getInputStream());

            JSONObject request = (JSONObject) entrada.readObject();
            String b = (String) request.get("id");
            //hacer una query a la base de datos con la palabra que se quiere obtener

            BasicDBObject query = new BasicDBObject("palabra", b);
            DBCursor cursor = collection.find(query);
            ArrayList<DocumentosDB> lista_doc = new ArrayList<>();
            // de la query tomo el campo documentos y los agrego a una lista
            try {
                while (cursor.hasNext()) {
                    //System.out.println(cursor.next());
                    BasicDBList campo_documentos = (BasicDBList) cursor.next().get("documentos");
                    // en el for voy tomando uno por uno los elementos en el campo documentos
                    for (Iterator<Object> it = campo_documentos.iterator(); it.hasNext();) {
                        BasicDBObject dbo = (BasicDBObject) it.next();
                        //DOC tiene id y frecuencia
                        DocumentosDB doc = new DocumentosDB();
                        doc.makefn2(dbo);
                        //int id = (int)doc.getId_documento();
                        //int f = (int)doc.getFrecuencia();

                        lista_doc.add(doc);

                        //*******************************************

                        //********************************************

                        //QUERY A LA COLECCION DE TEXTOS
                        /* BasicDBObject query_textos = new BasicDBObject("id", doc.getId_documento());//query
                         DBCursor cursor_textos = collection_textos.find(query_textos);
                         try {
                        while (cursor_textos.hasNext()) {
                                    
                                    
                            DBObject obj = cursor_textos.next();
                                
                            String titulo = (String) obj.get("titulo");
                            titulo = titulo + "\n\n";
                            String texto = (String) obj.get("texto");
                                
                            String texto_final = titulo + texto;
                            aux = texto_final;
                            lista_textos.add(texto_final);
                        }
                         } finally {
                        cursor_textos.close();
                         }*/
                        //System.out.println(doc.getId_documento());
                        //System.out.println(doc.getFrecuencia());

                    } // end for

                } //end while query

            } finally {
                cursor.close();
            }

            // ordeno la lista de menor a mayor
            Collections.sort(lista_doc, new Comparator<DocumentosDB>() {

                @Override
                public int compare(DocumentosDB o1, DocumentosDB o2) {
                    //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                    return o1.getFrecuencia().compareTo(o2.getFrecuencia());
                }
            });
            int tam = lista_doc.size() - 1;
            for (int j = tam; j >= 0; j--) {

                BasicDBObject query_textos = new BasicDBObject("id",
                        (int) lista_doc.get(j).getId_documento().intValue());//query
                DBCursor cursor_textos = collection_textos.find(query_textos);// lo busco
                try {
                    while (cursor_textos.hasNext()) {

                        DBObject obj = cursor_textos.next();
                        String titulo = "*******************************";
                        titulo += (String) obj.get("titulo");
                        int f = (int) lista_doc.get(j).getFrecuencia().intValue();
                        String strinf = Integer.toString(f);
                        titulo += "******************************* frecuencia:" + strinf;
                        titulo = titulo + "\n\n";

                        String texto = (String) obj.get("texto");

                        String texto_final = titulo + texto + "\n\n";
                        aux = aux + texto_final;
                        //lista_textos.add(texto_final);
                    }
                } finally {
                    cursor_textos.close();
                }

            }

            //actualizar el cache
            try {
                Socket cliente_cache = new Socket("localhost", 4500); // nos conectamos con el servidor
                ObjectOutputStream mensaje_cache = new ObjectOutputStream(cliente_cache.getOutputStream()); // get al output del servidor, que es cliente : socket del cliente q se conecto al server
                JSONObject actualizacion_cache = new JSONObject();
                actualizacion_cache.put("actualizacion", 1);
                actualizacion_cache.put("busqueda", b);
                actualizacion_cache.put("respuesta", aux);
                mensaje_cache.writeObject(actualizacion_cache); // envio el msj al servidor
            } catch (Exception ex) {

            }

            //RESPONDER DESDE EL SERVIDORIndex al FRONT
            ObjectOutputStream resp = new ObjectOutputStream(clienteNuevo.getOutputStream());// obtengo el output del cliente para mandarle un msj
            resp.writeObject(aux);
            System.out.println("msj enviado desde el servidor");

        }
    } catch (IOException ex) {
        Logger.getLogger(MainServidor.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:puma.central.pdp.CentralPUMAPDP.java

public static void main(String[] args) {
    // initialize log4j
    BasicConfigurator.configure();/* www  .j av  a  2  s.co  m*/

    CommandLineParser parser = new BasicParser();
    Options options = new Options();
    options.addOption("ph", "policy-home", true,
            "The folder where to find the policy file given with the given policy id. "
                    + "For default operation, this folder should contain the central PUMA policy (called "
                    + CENTRAL_PUMA_POLICY_FILENAME + ")");
    options.addOption("pid", "policy-id", true,
            "The id of the policy to be evaluated on decision requests. Default value: " + GLOBAL_PUMA_POLICY_ID
                    + ")");
    options.addOption("s", "log-disabled", true, "Verbose mode (true/false)");
    String policyHome = "";
    String policyId = "";

    // read command line
    try {
        CommandLine line = parser.parse(options, args);
        if (line.hasOption("help")) {
            HelpFormatter formatter = new HelpFormatter();
            formatter.printHelp("Simple PDP Test", options);
            return;
        }
        if (line.hasOption("policy-home")) {
            policyHome = line.getOptionValue("policy-home");
        } else {
            logger.log(Level.WARNING, "Incorrect arguments given.");
            return;
        }
        if (line.hasOption("log-disabled") && Boolean.parseBoolean(line.getOptionValue("log-disabled"))) {
            logger.log(Level.INFO, "Now switching to silent mode");
            LogManager.getLogManager().getLogger("").setLevel(Level.WARNING);
            //LogManager.getLogManager().reset();
        }
        if (line.hasOption("policy-id")) {
            policyId = line.getOptionValue("policy-id");
        } else {
            logger.log(Level.INFO, "Using default policy id: " + GLOBAL_PUMA_POLICY_ID);
            policyId = GLOBAL_PUMA_POLICY_ID;
        }
    } catch (ParseException e) {
        logger.log(Level.WARNING, "Incorrect arguments given.", e);
        return;
    }

    //
    // STARTUP THE RMI SERVER
    //      
    // if (System.getSecurityManager() == null) {
    // System.setSecurityManager(new SecurityManager());
    // }
    final CentralPUMAPDP pdp;
    try {
        pdp = new CentralPUMAPDP(policyHome, policyId);
    } catch (IOException e) {
        logger.log(Level.SEVERE, "FAILED to set up the CentralPUMAPDP. Quitting.", e);
        return;
    }

    try {
        Registry registry;
        try {
            registry = LocateRegistry.createRegistry(RMI_REGISITRY_PORT);
            logger.info("Created new RMI registry");
        } catch (RemoteException e) {
            // MDC: I hope this means the registry already existed.
            registry = LocateRegistry.getRegistry(RMI_REGISITRY_PORT);
            logger.info("Reusing existing RMI registry");
        }
        CentralPUMAPDPRemote stub = (CentralPUMAPDPRemote) UnicastRemoteObject.exportObject(pdp, 0);
        registry.bind(CENTRAL_PUMA_PDP_RMI_NAME, stub);
        logger.info(
                "Central PUMA PDP up and running (available using RMI with name \"central-puma-pdp\" on RMI registry port "
                        + RMI_REGISITRY_PORT + ")");
        Thread.sleep(100); // MDC: vroeger eindigde de Thread om n of andere reden, dit lijkt te werken...
    } catch (Exception e) {
        logger.log(Level.SEVERE, "FAILED to set up PDP as RMI server", e);
    }

    //
    // STARTUP THE THRIFT PEP SERVER
    //
    //logger.log(Level.INFO, "Not setting up the Thrift server");

    // set up server
    //      PEPServer handler = new PEPServer(new CentralPUMAPEP(pdp));
    //      RemotePEPService.Processor<PEPServer> processor = new RemotePEPService.Processor<PEPServer>(handler);
    //      TServerTransport serverTransport;
    //      try {
    //         serverTransport = new TServerSocket(THRIFT_PEP_PORT);
    //      } catch (TTransportException e) {
    //         e.printStackTrace();
    //         return;
    //      }
    //      TServer server = new TSimpleServer(new TServer.Args(serverTransport).processor(processor));
    //      System.out.println("Setting up the Thrift PEP server on port " + THRIFT_PEP_PORT);
    //      server.serve();
    //
    // STARTUP THE THRIFT PEP SERVER
    //
    //logger.log(Level.INFO, "Not setting up the Thrift server");

    // set up server
    // do this in another thread not to block the main thread
    new Thread(new Runnable() {
        @Override
        public void run() {
            RemotePDPService.Processor<CentralPUMAPDP> pdpProcessor = new RemotePDPService.Processor<CentralPUMAPDP>(
                    pdp);
            TServerTransport pdpServerTransport;
            try {
                pdpServerTransport = new TServerSocket(THRIFT_PDP_PORT);
            } catch (TTransportException e) {
                e.printStackTrace();
                return;
            }
            TServer pdpServer = new TThreadPoolServer(
                    new TThreadPoolServer.Args(pdpServerTransport).processor(pdpProcessor));
            logger.info("Setting up the Thrift PDP server on port " + THRIFT_PDP_PORT);
            pdpServer.serve();
        }
    }).start();
}

From source file:de.weltraumschaf.registermachine.App.java

/**
 * Main entry point for JVM./* w  w w.ja va 2 s  .  c om*/
 *
 * Catches all {@link Exception exception} and print their message to STDERR and exits with -1.
 *
 * @param args command line arguments
 */
public static void main(final String[] args) {
    final App app = new App(args);

    try {
        InvokableAdapter.main(app, IOStreams.newDefault(), app.isVerbose());
    } catch (UnsupportedEncodingException ex) {
        Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
        app.exit(-1);
    }
}

From source file:view.PrograssCharts.java

/**
 * @param args the command line arguments
 *//*from ww  w .j  av  a2 s .co  m*/
public static void main(String args[]) {
    /* Set the Nimbus look and feel */
    //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
    /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
     * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
     */
    try {
        for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                javax.swing.UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (ClassNotFoundException ex) {
        java.util.logging.Logger.getLogger(PrograssCharts.class.getName()).log(java.util.logging.Level.SEVERE,
                null, ex);
    } catch (InstantiationException ex) {
        java.util.logging.Logger.getLogger(PrograssCharts.class.getName()).log(java.util.logging.Level.SEVERE,
                null, ex);
    } catch (IllegalAccessException ex) {
        java.util.logging.Logger.getLogger(PrograssCharts.class.getName()).log(java.util.logging.Level.SEVERE,
                null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        java.util.logging.Logger.getLogger(PrograssCharts.class.getName()).log(java.util.logging.Level.SEVERE,
                null, ex);
    }
    //</editor-fold>

    /* Create and display the dialog */
    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            PrograssCharts dialog = new PrograssCharts(new javax.swing.JFrame(), true);
            dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                @Override
                public void windowClosing(java.awt.event.WindowEvent e) {
                    System.exit(0);
                }
            });
            dialog.setVisible(true);
        }
    });
}

From source file:task5.deneme.java

public static void main(String args[]) {
    /* Set the Nimbus look and feel */
    //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
    /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
     * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
     *//*from  www. java2 s  .  c om*/
    try {
        for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                javax.swing.UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (ClassNotFoundException ex) {
        java.util.logging.Logger.getLogger(deneme.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    } catch (InstantiationException ex) {
        java.util.logging.Logger.getLogger(deneme.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    } catch (IllegalAccessException ex) {
        java.util.logging.Logger.getLogger(deneme.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        java.util.logging.Logger.getLogger(deneme.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    }
    //</editor-fold>

    /* Create and display the form */
    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            new deneme().setVisible(true);
        }
    });
}

From source file:MonitorSaurausRex.MainMenu.java

/**
 * @param args the command line arguments
 *//*  w  ww. ja va  2  s . c  o  m*/
public static void main(String args[]) {
    /* Set the Nimbus look and feel */
    //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
    /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
     * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
     */
    try {
        for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                javax.swing.UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (ClassNotFoundException ex) {
        java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    } catch (InstantiationException ex) {
        java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    } catch (IllegalAccessException ex) {
        java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    }
    //</editor-fold>
    //</editor-fold>

    /* Create and display the form */
    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            new MainMenu().setVisible(true);
        }
    });

    /* Use an appropriate Look and Feel */
    try {
        UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
        //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } catch (UnsupportedLookAndFeelException | IllegalAccessException | InstantiationException
            | ClassNotFoundException ex) {
    }
    /* Turn off metal's use of bold fonts */
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    //Schedule a job for the event-dispatching thread:
    //adding TrayIcon.
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            createAndShowGUI();
        }
    });
}

From source file:CompareFiles.java

/**
 * @param args the command line arguments
 *///from   w ww  .  j  ava2  s .co m
public static void main(String args[]) {
    /* Set the Nimbus look and feel */
    //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
    /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
     * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
     */
    try {
        for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                javax.swing.UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (ClassNotFoundException ex) {
        java.util.logging.Logger.getLogger(CompareFiles.class.getName()).log(java.util.logging.Level.SEVERE,
                null, ex);
    } catch (InstantiationException ex) {
        java.util.logging.Logger.getLogger(CompareFiles.class.getName()).log(java.util.logging.Level.SEVERE,
                null, ex);
    } catch (IllegalAccessException ex) {
        java.util.logging.Logger.getLogger(CompareFiles.class.getName()).log(java.util.logging.Level.SEVERE,
                null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        java.util.logging.Logger.getLogger(CompareFiles.class.getName()).log(java.util.logging.Level.SEVERE,
                null, ex);
    }
    //</editor-fold>
    //</editor-fold>

    /* Create and display the form */
    java.awt.EventQueue.invokeLater(() -> {
        new CompareFiles().setVisible(true);
    });
}