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:jsonclient.JsonClient.java

public static void main(String args[]) {

    int EPS = 1;//from  ww w . j a  v a2  s . c o m
    List<Place> countries = new ArrayList<Place>();
    List<Thread> threads = new ArrayList<Thread>();
    Country country;
    countries = getCountries();
    //CountrySearcher countrySearcher = null;
    Iterator<Place> itrCountry = countries.iterator();
    ExecutorService exec = Executors.newFixedThreadPool(4);

    while (itrCountry.hasNext()) {
        country = new Country(itrCountry.next());
        CountrySearcher cs = new CountrySearcher(country, EPS);
        threads.add(cs.thread);
        exec.execute(cs);
    }

    exec.shutdown();

    for (Thread th : threads)
        try {
            th.join();
        } catch (InterruptedException ex) {
            Logger.getLogger(JsonClient.class.getName()).log(Level.SEVERE, null, ex);
        }

}

From source file:fr.inria.atlanmod.emf.graphs.Connectedness.java

public static void main(String[] args) {

    Options options = createOptions();/*ww  w  .j  av a2 s.c o  m*/

    CommandLineParser parser = new PosixParser();

    try {
        CommandLine commandLine = parser.parse(options, args);
        String inputMetamodel = commandLine.getOptionValue(INPUT_METAMODEL);
        String inputModel = commandLine.getOptionValue(INPUT_MODEL);
        Boolean logUnreachable = commandLine.hasOption(LOG_UNREACHABLE);

        ResourceSet resourceSet = new ResourceSetImpl();
        Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap()
                .put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());

        {
            LOG.log(Level.INFO, "Loading input metamodel");
            URI uri = URI.createFileURI(inputMetamodel);
            Resource resource = resourceSet.getResource(uri, true);
            registerEPackages(resource);
        }

        URI uri = URI.createFileURI(inputModel);

        LOG.log(Level.INFO, "Loading input model");
        Resource resource = resourceSet.getResource(uri, true);

        LOG.log(Level.INFO, "Getting input model contents");
        Set<EObject> resourceContents = getResourceContents(resource);
        int totalCount = resourceContents.size();

        LOG.log(Level.INFO, MessageFormat.format("Input model contains {0} elements", totalCount));

        List<EClassifier> candidateEClassifiers = buildCandidateEClassifiers();

        for (Iterator<EObject> it = resource.getAllContents(); it.hasNext();) {
            EObject eObject = it.next();
            if (candidateEClassifiers.contains(eObject.eClass())) {
                Set<EObject> reachableEObjects = getReachableEObjects(eObject);
                int i = reachableEObjects.size();
                LOG.log(Level.INFO, MessageFormat.format("Found {0} reachable objects from {1} (EClass {2})", i,
                        EcoreUtil.getURI(eObject), eObject.eClass().getName()));
                if (logUnreachable) {
                    Set<EObject> unreachableEObjects = new HashSet<>(resourceContents);
                    unreachableEObjects.removeAll(reachableEObjects);
                    LOG.log(Level.INFO,
                            MessageFormat.format("{0} elements are unreachable from {1} (EClass {2})",
                                    unreachableEObjects.size(), EcoreUtil.getURI(eObject),
                                    eObject.eClass().getName()));
                    for (EObject unreachableEObject : unreachableEObjects) {
                        LOG.log(Level.INFO, MessageFormat.format("Unreachable EObject {0} is of type {1}",
                                EcoreUtil.getURI(unreachableEObject), unreachableEObject.eClass()));
                    }
                }
            }
        }

    } catch (ParseException e) {
        LOG.log(Level.SEVERE, e.getLocalizedMessage(), e);
        LOG.log(Level.INFO, "Current arguments: " + Arrays.toString(args));
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("java -jar <this-file.jar>", options, true);
    } catch (Throwable e) {
        LOG.log(Level.SEVERE, e.getLocalizedMessage(), e);
        MessageUtil.showError(e.toString());
    }
}

From source file:com.cfets.door.yarn.jboss.JBossApplicationMaster.java

/**
 * @param args/*from w w  w . j  a va2s.c om*/
 *            Command line args
 */
public static void main(String[] args) {
    boolean result = false;
    try {
        JBossApplicationMaster appMaster = new JBossApplicationMaster();
        LOG.info("Initializing JBossApplicationMaster");
        boolean doRun = appMaster.init(args);
        if (!doRun) {
            System.exit(0);
        }
        result = appMaster.run();
    } catch (Throwable t) {
        LOG.log(Level.SEVERE, "Error running JBossApplicationMaster", t);
        System.exit(1);
    }
    if (result) {
        LOG.info("Application Master completed successfully. exiting");
        System.exit(0);
    } else {
        LOG.info("Application Master failed. exiting");
        System.exit(2);
    }
}

From source file:com.archivas.clienttools.arcmover.cli.ArcJobMgr.java

@SuppressWarnings({ "UseOfSystemOutOrSystemErr" })
public static void main(String args[]) {
    ArcJobMgr arcJobMgr = null;//from   w  w w.  j a v a 2  s .c  o  m

    ConfigurationHelper.validateLaunchOK();

    try {
        arcJobMgr = new ArcJobMgr(args);
        arcJobMgr.parseArgs();
        if (cmdAction == JobMgrAction.HELP) {
            System.out.println(arcJobMgr.helpScreen());
        } else {
            arcJobMgr.execute(new PrintWriter(System.out), new PrintWriter(System.err));
        }
    } catch (ParseException e) {
        System.out.println("Error: " + e.getMessage());
        System.out.println();
        System.out.println(arcJobMgr.helpScreen());
        arcJobMgr.setExitCode(EXIT_CODE_OPTION_PARSE_ERROR);
    } catch (Exception e) {
        LOG.log(Level.SEVERE, "Unexpected Exception.", e);
        System.out.println();
        System.out.println("Failed to create a new profile " + e.getMessage());
        arcJobMgr.setExitCode(EXIT_CODE_DM_ERROR);
    } finally {
        if (arcJobMgr != null) {
            arcJobMgr.exit();
        }
    }
}

From source file:eu.cognitum.readandwrite.App.java

public static void main(String[] args) {
    try {/*w  ww  .  j a v  a  2  s  .c o m*/
        String configFile = 0 == args.length ? "example.properties" : args[0];

        CONFIGURATION = new Properties();
        File f = new File(configFile);
        if (!f.exists()) {
            LOGGER.warning("configuration not found at " + configFile);
            return;
        }
        LOGGER.info("loading configuration file " + f.getAbsoluteFile());
        CONFIGURATION.load(new FileInputStream(f));

        String ip = CONFIGURATION.getProperty(PROP_STORAGE_HOSTNAME);
        String keyspace = CONFIGURATION.getProperty(PROP_STORAGE_KEYSPACE);
        String directory = CONFIGURATION.getProperty(PROP_STORAGE_DIRECTORY);

        // N of articles to be generated.
        int Narticles = 100000;
        // size of the buffer to commit each time
        int commitBufferSize = 100;
        // N of articles to commit before trying reads
        int readStep = 100;

        String currentNamespace = "http://mynamespace#";
        LOGGER.log(Level.INFO, "Generating the rdf...");
        GenerateRdf rdfGenerator = new GenerateRdf(currentNamespace, "tmp.rdf");
        rdfGenerator.generateAndSaveRdf(Narticles);
        LOGGER.log(Level.INFO, "Generated the rdf!");
        ArrayList<SimulateReadAndWrite> simulateAll = new ArrayList<SimulateReadAndWrite>();

        int Ndbs = 0;

        DBS[] chosenDbs = { DBS.NATIVE };
        //DBS[] chosenDbs = DBS.values();

        for (DBS dbs : chosenDbs) {
            SailRepository sr;

            switch (dbs) {
            case NATIVE:
                sr = createNativeStoreConnection(directory);
                break;
            case TITAN:
                sr = createTitanConnection(ip, keyspace);
                break;
            case NEO4J:
                sr = createNeo4jConnection(keyspace);
                break;
            case ORIENT:
                sr = createOrientConnection(keyspace);
                break;
            default:
                sr = null;
                break;
            }

            if (sr == null) {
                throw new Exception("Something wrong while connecting to " + dbs.toString());
            }

            simulateAll.add(new SimulateReadAndWrite(sr, "test" + dbs.toString(), Narticles, readStep,
                    commitBufferSize, dbs.toString(), keyspace, currentNamespace, rdfGenerator));

            simulateAll.get(Ndbs).start();
            Ndbs++;
        }

        int Nfinished = 0;
        int k;
        while (Nfinished != Ndbs) {
            Nfinished = 0;
            k = 0;
            for (DBS dbs : chosenDbs) {
                if (simulateAll.get(k).IsProcessCompleted()) {
                    Nfinished++;
                } else {
                    System.out.println(String.format("Process for db %s is at %.2f", dbs.toString(),
                            simulateAll.get(k).GetProgress()));
                }
                k++;
            }
            Thread.sleep(10000);
        }

    } catch (Exception ex) {
        LOGGER.log(Level.SEVERE, null, ex);
    }
}

From source file:com.oz.digital.sign.window.MainView.java

/**
 * @param args the command line arguments
 *///from www  .j ava 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 ("GTK+".equals(info.getName())) {
                javax.swing.UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
            | javax.swing.UnsupportedLookAndFeelException ex) {
        LOG.log(Level.SEVERE, null, ex);
    }
    //</editor-fold>

    MainView mainView = new MainView();
    mainView.setVisible(true);

    while (true) {
        final String entry = mainView.getTxtfEntry().getText();

        if (StringUtils.isNotBlank(entry)) {
            LOG.log(Level.INFO, "== Agregando la entrada : {0}", entry);

            String entryFormatted = String.format("%s -> %s\n",
                    DateFormatUtils.format(new Date(), "dd/MM/yyyy hh:mm:ss"), entry);
            mainView.getTxtAreaEntryHistory().append(entryFormatted);
        }

        try {
            Thread.sleep(5000);
        } catch (InterruptedException ex) {
            LOG.log(Level.SEVERE, ex.getMessage());
        }
    }
}

From source file:edu.ifpb.pos.restletclient.CommandLineApp.java

public static void main(String[] args) {
    try {/*from   w w  w . ja  va2s . c om*/
        CommandLineParser parser = new DefaultParser();
        CommandLine line = parser.parse(getOp(), args);
        execute(line);
    } catch (ParseException ex) {
        System.out.println("ERROR: " + ex.getMessage());
    } catch (IOException ex) {
        Logger.getLogger(CommandLineApp.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:com.willwinder.universalgcodesender.ExperimentalWindow.java

/**
 * @param args the command line arguments
 *///from  ww w  . j ava  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(ExperimentalWindow.class.getName())
                .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
        java.util.logging.Logger.getLogger(ExperimentalWindow.class.getName())
                .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
        java.util.logging.Logger.getLogger(ExperimentalWindow.class.getName())
                .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        java.util.logging.Logger.getLogger(ExperimentalWindow.class.getName())
                .log(java.util.logging.Level.SEVERE, null, ex);
    }
    //</editor-fold>

    // Fix look and feel to use CMD+C/X/V/A instead of CTRL
    if (SystemUtils.IS_OS_MAC) {
        Collection<InputMap> ims = new ArrayList<>();
        ims.add((InputMap) UIManager.get("TextField.focusInputMap"));
        ims.add((InputMap) UIManager.get("TextArea.focusInputMap"));
        ims.add((InputMap) UIManager.get("EditorPane.focusInputMap"));
        ims.add((InputMap) UIManager.get("FormattedTextField.focusInputMap"));
        ims.add((InputMap) UIManager.get("PasswordField.focusInputMap"));
        ims.add((InputMap) UIManager.get("TextPane.focusInputMap"));

        int c = KeyEvent.VK_C;
        int v = KeyEvent.VK_V;
        int x = KeyEvent.VK_X;
        int a = KeyEvent.VK_A;
        int meta = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();

        for (InputMap im : ims) {
            im.put(KeyStroke.getKeyStroke(c, meta), DefaultEditorKit.copyAction);
            im.put(KeyStroke.getKeyStroke(v, meta), DefaultEditorKit.pasteAction);
            im.put(KeyStroke.getKeyStroke(x, meta), DefaultEditorKit.cutAction);
            im.put(KeyStroke.getKeyStroke(a, meta), DefaultEditorKit.selectAllAction);
        }
    }

    /* Create the form */
    //        GUIBackend backend = new GUIBackend();
    final ExperimentalWindow mw = new ExperimentalWindow();

    /* Apply the settings to the ExperimentalWindow bofore showing it */

    mw.setSize(mw.backend.getSettings().getMainWindowSettings().width,
            mw.backend.getSettings().getMainWindowSettings().height);
    mw.setLocation(mw.backend.getSettings().getMainWindowSettings().xLocation,
            mw.backend.getSettings().getMainWindowSettings().yLocation);

    mw.addComponentListener(new ComponentListener() {
        @Override
        public void componentResized(ComponentEvent ce) {
            mw.backend.getSettings().getMainWindowSettings().height = ce.getComponent().getSize().height;
            mw.backend.getSettings().getMainWindowSettings().width = ce.getComponent().getSize().width;
        }

        @Override
        public void componentMoved(ComponentEvent ce) {
            mw.backend.getSettings().getMainWindowSettings().xLocation = ce.getComponent().getLocation().x;
            mw.backend.getSettings().getMainWindowSettings().yLocation = ce.getComponent().getLocation().y;
        }

        @Override
        public void componentShown(ComponentEvent ce) {
        }

        @Override
        public void componentHidden(ComponentEvent ce) {
        }
    });

    /* Display the form */
    java.awt.EventQueue.invokeLater(new Runnable() {

        @Override
        public void run() {
            mw.setVisible(true);
        }
    });

    Runtime.getRuntime().addShutdownHook(new Thread() {
        @Override
        public void run() {
            mw.connectionPanel.saveSettings();
            mw.commandPanel.saveSettings();

            if (mw.pendantUI != null) {
                mw.pendantUI.stop();
            }
        }
    });
}

From source file:eu.edisonproject.training.execute.Main.java

public static void main(String args[]) {
    Options options = new Options();
    Option operation = new Option("op", "operation", true,
            "type of operation to perform. " + "For term extraction use 'x'.\n"
                    + "Example: -op x -i E-COCO/documentation/sampleTextFiles/databases.txt "
                    + "-o E-COCO/documentation/sampleTextFiles/databaseTerms.csv"
                    + "For word sense disambiguation use 'w'.\n"
                    + "Example: -op w -i E-COCO/documentation/sampleTextFiles/databaseTerms.csv "
                    + "-o E-COCO/documentation/sampleTextFiles/databse.avro\n"
                    + "For tf-idf vector extraction use 't'.\n" + "For running the apriori algorithm use 'a'");
    operation.setRequired(true);//  w w  w.ja  v a  2 s  .  c o m
    options.addOption(operation);

    Option input = new Option("i", "input", true, "input file path");
    input.setRequired(true);
    options.addOption(input);

    Option output = new Option("o", "output", true, "output file");
    output.setRequired(true);
    options.addOption(output);

    Option popertiesFile = new Option("p", "properties", true, "path for a properties file");
    popertiesFile.setRequired(false);
    options.addOption(popertiesFile);

    Option termsFile = new Option("t", "terms", true, "terms file");
    termsFile.setRequired(false);
    options.addOption(termsFile);

    String helpmasg = "Usage: \n";
    for (Object obj : options.getOptions()) {
        Option op = (Option) obj;
        helpmasg += op.getOpt() + ", " + op.getLongOpt() + "\t Required: " + op.isRequired() + "\t\t"
                + op.getDescription() + "\n";
    }

    try {
        CommandLineParser parser = new BasicParser();
        CommandLine cmd = parser.parse(options, args);

        String propPath = cmd.getOptionValue("properties");
        if (propPath == null) {
            prop = ConfigHelper
                    .getProperties(".." + File.separator + "etc" + File.separator + "configure.properties");
        } else {
            prop = ConfigHelper.getProperties(propPath);
        }
        //            ${user.home}

        switch (cmd.getOptionValue("operation")) {
        case "x":
            termExtraction(cmd.getOptionValue("input"), cmd.getOptionValue("output"));
            break;
        case "w":
            wsd(cmd.getOptionValue("input"), cmd.getOptionValue("output"));
            break;
        case "t":
            calculateTFIDF(cmd.getOptionValue("input"), cmd.getOptionValue("output"));
            break;
        //                case "tt":
        //                    calculateTermTFIDF(cmd.getOptionValue("input"), cmd.getOptionValue("terms"), cmd.getOptionValue("output"));
        //                    break;
        case "a":
            apriori(cmd.getOptionValue("input"), cmd.getOptionValue("output"));
            break;
        default:
            System.out.println(helpmasg);
        }

    } catch (Exception ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, helpmasg, ex);
    }
}

From source file:org.eclipse.lyo.client.oslc.samples.GenericCMSample.java

/**
 * Access a CM service provider and perform some OSLC actions
 * @param args//w w w. j ava  2  s  .  com
 * @throws ParseException 
 */
public static void main(String[] args) throws ParseException {

    Options options = new Options();

    options.addOption("url", true, "url"); //the OSLC catalog URL
    options.addOption("providerTitle", true, "Service Provider title");

    CommandLineParser cliParser = new GnuParser();

    //Parse the command line
    CommandLine cmd = cliParser.parse(options, args);

    if (!validateOptions(cmd)) {
        logger.severe(
                "Syntax:  java <class_name> -url https://<server>:port/<context>/<catalog_location> -providerTitle \"<provider title>\"");
        logger.severe(
                "Example: java GenericCMSample -url https://exmple.com:8080/OSLC4JRegistry/catalog/1 -providerTitle \"OSLC Lyo Change Management Service Provider\"");
        return;
    }

    String catalogUrl = cmd.getOptionValue("url");
    String providerTitle = cmd.getOptionValue("providerTitle");

    try {

        //STEP 1: Create a new generic OslcClient
        OslcClient client = new OslcClient();

        //STEP 2: Find the OSLC Service Provider for the project area we want to work with
        String serviceProviderUrl = client.lookupServiceProviderUrl(catalogUrl, providerTitle);

        //STEP 3: Get the Query Capabilities and Creation Factory URLs so that we can run some OSLC queries
        String queryCapability = client.lookupQueryCapability(serviceProviderUrl, OSLCConstants.OSLC_CM_V2,
                OSLCConstants.CM_CHANGE_REQUEST_TYPE);

        String creationFactory = client.lookupCreationFactory(serviceProviderUrl, OSLCConstants.OSLC_CM_V2,
                OSLCConstants.CM_CHANGE_REQUEST_TYPE);

        //SCENARIO A: Run a query for all ChangeRequests 

        OslcQueryParameters queryParams = new OslcQueryParameters();
        OslcQuery query = new OslcQuery(client, queryCapability);

        OslcQueryResult result = query.submit();

        boolean processAsJavaObjects = true;
        processPagedQueryResults(result, client, processAsJavaObjects);

        System.out.println("\n------------------------------\n");

        //SCENARIO B:  Run a query for a specific ChangeRequest and then print it as raw XML.  
        //Change the URL below to match a real ChangeRequest

        ClientResponse rawResponse = client.getResource(
                "http://localhost:8080/OSLC4JChangeManagement/changeRequests/1", OSLCConstants.CT_XML);
        processRawResponse(rawResponse);
        rawResponse.consumeContent();

        //SCENARIO C:  ChangeRequest creation and update
        ChangeRequest newChangeRequest = new ChangeRequest();
        newChangeRequest.setTitle("Update database schema");
        newChangeRequest.setTitle("Need to update the database schema to reflect the data model changes");

        rawResponse = client.createResource(creationFactory, newChangeRequest, OSLCConstants.CT_RDF);
        int statusCode = rawResponse.getStatusCode();
        rawResponse.consumeContent();
        System.out.println("Status code for POST of new artifact: " + statusCode);

        if (statusCode == HttpStatus.SC_CREATED) {
            String location = rawResponse.getHeaders().getFirst("Location");
            newChangeRequest.setClosed(false);
            newChangeRequest.setInProgress(true);
            rawResponse = client.updateResource(location, newChangeRequest, OSLCConstants.CT_RDF);
            rawResponse.consumeContent();
            System.out.println("Status code for PUT of updated artifact: " + rawResponse.getStatusCode());
        }

    } catch (Exception e) {
        logger.log(Level.SEVERE, e.getMessage(), e);
    }

}