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:com.rest.samples.getTipoCambioBanxico.java

public static void main(String[] args) {
    String url = "http://www.banxico.org.mx/tipcamb/llenarTiposCambioAction.do?idioma=sp";
    try {/*from  w w  w  . j a  v  a  2s  . c  o  m*/
        HttpClient hc = HttpClientBuilder.create().build();
        HttpGet request = new HttpGet(url);
        request.setHeader("User-Agent", "Mozilla/5.0");
        request.setHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");

        HttpResponse res = hc.execute(request);
        if (res.getStatusLine().getStatusCode() != 200) {
            throw new RuntimeException("Failed : HTTP eror code: " + res.getStatusLine().getStatusCode());
        }

        BufferedReader rd = new BufferedReader(new InputStreamReader(res.getEntity().getContent()));
        StringBuffer result = new StringBuffer();
        String line = "";
        while ((line = rd.readLine()) != null) {
            result.append(line);
        }
        Document doc = Jsoup.parse(result.toString());
        Element tipoCambioFix = doc.getElementById("FIX_DATO");
        System.out.println(tipoCambioFix.text());

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

From source file:hms.hwestra.interactionrebuttal.InteractionRebuttal.java

/**
 * @param args the command line arguments
 *///from ww w.j  av  a2 s  .co  m
public static void main(String[] args) {

    InteractionRebuttal r = new InteractionRebuttal();
    try {
        r.run();
        // TODO code application logic here
    } catch (IOException ex) {
        Logger.getLogger(InteractionRebuttal.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:fr.logfiletoes.Main.java

public static void main(String[] args) throws IOException {
    String configFile = getConfigFilePath();

    LOG.log(Level.INFO, "Load config file \"{0}\"", configFile);
    Config config = new Config(configFile);
    LOG.info("Config file OK");

    for (Unit unit : config.getUnits()) {
        unit.start();/* w  ww  . j  a  v  a2s  .  c  o  m*/
    }

    while (true) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

From source file:com.rest.samples.getReportFromJasperServer.java

public static void main(String[] args) {
    // TODO code application logic here
    String url = "http://username:password@10.49.28.3:8081/jasperserver/rest_v2/reports/Reportes/vencimientos.pdf?feini=2016-09-30&fefin=2016-09-30";
    try {/* ww  w.j a  v a  2s  . c  o  m*/
        HttpClient hc = HttpClientBuilder.create().build();
        HttpGet getMethod = new HttpGet(url);
        getMethod.addHeader("accept", "application/pdf");
        HttpResponse res = hc.execute(getMethod);
        if (res.getStatusLine().getStatusCode() != 200) {
            throw new RuntimeException("Failed : HTTP eror code: " + res.getStatusLine().getStatusCode());
        }

        InputStream is = res.getEntity().getContent();
        OutputStream os = new FileOutputStream(new File("vencimientos.pdf"));
        int read = 0;
        byte[] bytes = new byte[2048];

        while ((read = is.read(bytes)) != -1) {
            os.write(bytes, 0, read);
        }
        is.close();
        os.close();

        if (Desktop.isDesktopSupported()) {
            File pdfFile = new File("vencimientos.pdf");
            Desktop.getDesktop().open(pdfFile);
        }

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

From source file:edu.unc.irss.arc.de.dvpublisher.DataverseClient.java

public static void main(String[] args) throws MalformedURLException {
    if (args.length != 5) {
        logger.log(Level.SEVERE,
                "Three arguments: dataverse_URL, Api_key, dataverse_Alias are expected dataset_Id file_location");
        throw new IllegalArgumentException("The number of arguments must be 5.");
    }//from   ww  w  . ja  v a2 s .  c  om

    for (String arg : args) {
        logger.log(Level.INFO, "arg={0}", arg);
    }

    if (StringUtils.isBlank(args[0])) {
        logger.log(Level.SEVERE, "dataverse URL should not be blank");
        throw new IllegalArgumentException("dataverse URL should not be blank");
    }

    if (StringUtils.isBlank(args[1])) {
        logger.log(Level.SEVERE, "API key should not be blank");
        throw new IllegalArgumentException("API Key should not be blank");
    }

    if (StringUtils.isBlank(args[2])) {
        logger.log(Level.SEVERE, "dataverse alias should not be blank");
        throw new IllegalArgumentException("dataverse alias should not be blank");
    }

    if (StringUtils.isBlank(args[3])) {
        logger.log(Level.SEVERE, "dataset Id should not be blank");
        throw new IllegalArgumentException("dataset Id should not be blank");
    }

    if (StringUtils.isBlank(args[4])) {
        logger.log(Level.SEVERE, "file location should not be blank");
        throw new IllegalArgumentException("file location should not be blank");
    }

    logger.log(Level.INFO, "running main method");
    logger.log(Level.INFO, "dataverseUrl:{0}", args[0]);
    logger.log(Level.INFO, "apiKey:{0}", args[1]);
    logger.log(Level.INFO, "dataverseAlias:{0}", args[2]);
    logger.log(Level.INFO, "datasetId:{0}", args[3]);
    logger.log(Level.INFO, "fileLocation:{0}", args[4]);

    DataverseClient dvClient = new DataverseClient(args[0], args[1], args[2]);

    logger.log(Level.INFO, "uploading a file to a target dataverse");
    dvClient.publishDatafile(args[3], args[4]);
    logger.log(Level.INFO, "uploading has been finished");
}

From source file:checkchansourcedata.CheckChanSourceData.java

/**
 * @param args the command line arguments
 *///from   w ww  . j  a v a  2 s .co  m
public static void main(String[] args) {
    CheckChanSourceData me = new CheckChanSourceData();
    try {
        if (me.parseCommand(args, me.getClass().getSimpleName(), "0.0.1")) {
            me.go();
        }
    } catch (Exception ex) {
        Logger.getLogger(CheckChanSourceData.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:eu.edisonproject.utility.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. " + "To move cached terms from org.mapdb.DB 'm'");
    operation.setRequired(true);// ww w .j  a va2 s.c  om
    options.addOption(operation);

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

    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);

        switch (cmd.getOptionValue("operation")) {
        case "m":
            DBTools.portTermCache2Hbase(cmd.getOptionValue("input"));
            DBTools.portBabelNetCache2Hbase(cmd.getOptionValue("input"));
            break;
        default:
            System.out.println(helpmasg);
        }

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

From source file:be.kdg.repaircafemodel.TestRepairCafe.java

public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext(
            "be/kdg/repaircafemodel/spring/root-context.xml");

    // Get userService from Spring Context
    UserService userService = (UserService) context.getBean("userService");

    // Get repairService from Spring Context
    RepairService repairService = (RepairService) context.getBean("repairService");

    // Create a client
    Address address1 = new Address("Nationalestraat", "5", "2000", "Antwerpen");
    Person person1 = new Person("Jan", "Peeters", address1);
    Client client = new Client(person1, "jan.peeters@student.kdg.be", "jan");

    // Create a repairer
    Address address2 = new Address("Nationalestraat", "5", "2000", "Antwerpen");
    Person person2 = new Person("Wouter", "Deketelaere", address2);
    Repairer repairGuy = new Repairer(person2, "wouter.deketelaere@kdg.be", "jef", "Master");
    try {/*from ww w .j av  a2 s  . co  m*/
        userService.addUser(client);
        userService.addUser(repairGuy);
    } catch (UserServiceException ex) {
        Logger.getLogger(TestRepairCafe.class.getName()).log(Level.SEVERE, null, ex);
    }

    // update een gebruiker met een nieuw wachtwoord                
    try {
        userService.updatePassword(repairGuy, "jef", "wouter");
        userService.checkLogin(repairGuy.getUsername(), "wouter");
    } catch (UserServiceException ex) {
        Logger.getLogger(TestRepairCafe.class.getName()).log(Level.SEVERE, null, ex);
    }

    try {
        userService.checkLogin("wouter.deketelaere@kdg.be", "wouter");
    } catch (UserServiceException ex) {
        Logger.getLogger(TestRepairCafe.class.getName()).log(Level.SEVERE, null, ex);
    }

    Repair repair = new Repair(new Item("G 4210 i", "Miele", "Vaatwasser"), new RepairDetails("Elektrisch",
            "Toestel stopt niet meer", RepairDetails.PriceModel.FIXED, new DateTime().plusWeeks(2)));

    repairService.submitRepair(client, repair);
    System.out.println(repairService.getAllCategories());
    repairService.placeBid(repairGuy, repair, 200.0);

    System.out.println(repairService.findAllRepairsByClient(client));
    repairService.placeBid(repairGuy, repair, 150);

    try {
        System.out.println(repairService.findRepairsByCategory("Vaatwasser"));
        System.out.println(repairService.findRepairsByDefect("Elektrisch"));
        System.out.println(repairService.getBids(repairGuy));
    } catch (RepairServiceException ex) {
        Logger.getLogger(TestRepairCafe.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:es.sistedes.handle.generator.CliLauncher.java

public static void main(String[] args) {
    try {/*from   w w  w. j  av a  2 s.c om*/
        run(args);
    } catch (Throwable t) {
        if (t instanceof RuntimeException || t instanceof Error) {
            // Log unexpected unchecked exception
            LOGGER.log(Level.SEVERE, t.toString(), t);
        }
        System.exit(ReturnCodes.ERROR.getReturnCode());
    }
}

From source file:edu.cwru.sepia.Main.java

public static void main(String[] args) {
    if (args.length == 0) {
        System.out.println("You must specify a configuration file.");
        return;/* w ww  . j a  va 2s .  co m*/
    }

    HierarchicalConfiguration config = null;
    try {
        config = getConfiguration(args[0]);
    } catch (ConfigurationException ex) {
        logger.log(Level.SEVERE, args[0] + " is not a valid XML or INI configuration file.", ex);
        return;
    }

    StateCreator stateCreator;
    try {
        stateCreator = getStateCreator(config);
    } catch (JAXBException ex) {
        logger.log(Level.SEVERE, config.getString("map") + " is not a valid map file.", ex);
        return;
    }

    Agent[] agents = getAgents(config);
    if (agents == null)
        return;

    Runner runner;
    try {
        runner = getRunner(config, stateCreator, agents);
    } catch (Exception ex) {
        logger.log(Level.SEVERE, "Unable to instantiate episode runner " + config.getString("runner.class"),
                ex);
        return;
    }

    runner.run();
}