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:invoice.GetInvoice.java

/**
 * @param args the command line arguments
 */// w  w  w . j  a  v a 2 s  .c om
public static void main(String[] args) {

    NumberFormat nf = NumberFormat.getInstance();
    nf.setGroupingUsed(false);
    nf.setMaximumFractionDigits(2);
    nf.setMinimumFractionDigits(2);
    nf.setRoundingMode(RoundingMode.HALF_UP);

    try {
        JSONObject arg_json = new JSONObject(args[0]);
    } catch (JSONException ex) {
        Logger.getLogger(GetInvoice.class.getName()).log(Level.SEVERE, null, ex);
    }
    HashMap<String, Object> hm = new HashMap<>();
    hm.put("duplicate", "");
    hm.put("distributor", "//oshan" + "\n" + "//kapuhempala" + "\n\nArea: " + "//galle");
    hm.put("customer", "//owner" + "\n" + "//Agro" + "\n" + "//Agro add" + "\n" + "//0771894851");
    hm.put("invNo", "GSLTS" + String.format("%04d", Integer.parseInt("//100")));
    hm.put("invDate", "2014-01-10");
    hm.put("invCode", "300");

    double invoiceTotal = 500000;
    if (5 > 0) {//ShopDiscount
        double discountprice = (invoiceTotal * 99) / 100;//getShopDiscount()
        hm.put("invoiceDiscount", nf.format((invoiceTotal) * 99 / 100));//getRetail_discount()

    } else {
        hm.put("invoiceDiscount", "");
    }
    hm.put("gross_total", nf.format(invoiceTotal));
    hm.put("invoiceTotal", nf.format(((invoiceTotal) * (100 - 99) / 100)));//getRetail_discount()
    hm.put("salesPersonName", "rep");
    hm.put("salesPersonContactNo", "0772189584");

    JTable jTable1 = new JTable();
    jTable1.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {},
            new String[] { "ITEMCODE", "DESCRIPTION", "QTY", "FREEQTY", "PRICE", "AMOUNT" }));
    String reportSource = "./ireports/invoice.jrxml";
    DefaultTableModel dtm = (DefaultTableModel) jTable1.getModel();
    try {
        JasperReport jr = JasperCompileManager.compileReport(reportSource);
        JasperPrint jp = JasperFillManager.fillReport(jr, hm, new JRTableModelDataSource(dtm));
        JasperPrintManager.printReport(jp, false);
    } catch (JRException ex) {
        Logger.getLogger(GetInvoice.class.getName()).log(Level.SEVERE, null, ex);
    }
    System.out.println("1");
}

From source file:net.vnt.ussdapp.util.ContextTest.java

public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "/context.xml" });
    ContextProperties ctxProp = (ContextProperties) Context.getInstance().getBean("ContextProperties");
    TXTParser parser = (TXTParser) Context.getInstance().getBean("TXTParser");
    String mainmenu = ctxProp.getProperty("ussdapp.wrong");
    try {// w ww.j a v  a 2s. c  o m
        Vector<String> vs = parser.readFields(mainmenu);
        Enumeration<String> ens = vs.elements();
        StringBuilder sb = new StringBuilder();
        while (ens.hasMoreElements()) {
            sb.append(ens.nextElement()).append("\n");
        }
        System.out.println(sb.toString());
    } catch (IOException ex) {
        Logger.getLogger(ContextTest.class.getName()).log(Level.SEVERE, null, ex);
    }
    System.out.println(System.getProperty("os.arch"));
}

From source file:urbanchart.java

public static void main(String[] arg) {
    final DefaultPieDataset data = new DefaultPieDataset();
    data.setValue("Housing(35%)($1050)", new Double(35));
    data.setValue("Debt(15%)($450)", new Double(15));
    data.setValue("transportation(15%)($450)", new Double(15));
    data.setValue("Food(15%)($450)", new Double(25));
    data.setValue("Saving(10%)($300)", new Double(10));
    JFreeChart chart = ChartFactory.createPieChart(
            "Average Distribution of expenses on income assuming 3000$/month (Urban areas)", data, true, true,
            false);/*from   w w w. j  av  a2 s .  c  o m*/
    final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
    final File file1 = new File("E:\\java projects\\hackathon1\\web\\piecharturban.jpg");
    try {
        ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info);
    } catch (IOException ex) {
        Logger.getLogger(urbanchart.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:MyTest.ParseJson.java

public static void main(String args[]) {
    try {//from w ww . jav  a  2 s  .c o  m
        FileReader reader = new FileReader(
                new File("data/NGS___RNA-seq_differential_expression_analysis-v1.ga"));
        System.out.println(reader);
        JSONParser parser = new JSONParser();
        JSONObject jo = (JSONObject) parser.parse(reader);
        JSONObject jsteps = (JSONObject) jo.get("steps");

        System.out.println(jsteps.size());
        System.out.println("---------------------------------------------------");
        for (int i = 0; i < jsteps.size(); i++) {
            JSONObject jstep_detail = (JSONObject) jsteps.get(String.valueOf(i));
            getDetailInfo(jstep_detail);

        }

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

}

From source file:com.mycompany.airportdatabasebuilder.DatabaseBuilder.java

public static void main(String[] args) {
    try {// w  ww .j a  v  a2 s .  c om
        Dao dao = new Dao();
        JdbcTemplate jdbcTemplate = dao.getJdbcTemplate();
        CSVReader reader = new CSVReader(new FileReader("airportdata2.csv"));
        String[] nextLine;
        int i = 0;
        while ((nextLine = reader.readNext()) != null) {
            if (nextLine[4] == null || nextLine[4].equals(""))
                System.out.println("empty code found");
            else {
                jdbcTemplate.update(
                        "INSERT INTO airportdata (airport_name, city, country, iata) VALUES(?, ?, ?, ?)",
                        nextLine[1], nextLine[2], nextLine[3], nextLine[4]);
            }
            i++;
        }

        // Airport(1)/ City(2)/ Country(3)/ Code(4)
        System.out.println(i + " rows were read");
    } catch (FileNotFoundException ex) {
        Logger.getLogger(DatabaseBuilder.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(DatabaseBuilder.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:ruralchart.java

public static void main(String[] arg) {
    final DefaultPieDataset data = new DefaultPieDataset();
    data.setValue("Housing(35%)($350)", new Double(35));
    data.setValue("Debt(15%)($150)", new Double(15));
    data.setValue("transportation(15%)($150)", new Double(15));
    data.setValue("Food(15%)($250)", new Double(25));
    data.setValue("Saving(10%)($100)", new Double(10));
    JFreeChart chart = ChartFactory.createPieChart(
            "Average Distribution of expenses on income assuming 1000$/month (Rural areas)", data, true, true,
            false);//from  w w  w  .j a  va 2  s.com
    final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
    final File file1 = new File("E:\\java projects\\hackathon1\\web\\piechartrural.jpg");
    try {
        ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info);
    } catch (IOException ex) {
        Logger.getLogger(urbanchart.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:com.epitech.oliver_f.astextexls.MainClass.java

public static void main(String[] args) {
    initalizeOption();/*  w  w w  .j  a  v  a2s  . c  om*/
    CommandLineParser parser = new BasicParser();
    CommandLine cl = null;
    try {
        cl = parser.parse(options, args);
    } catch (ParseException ex) {
        Logger.getLogger(MainClass.class.getName()).log(Level.SEVERE, null, ex);
    }
    if (cl != null && cl.hasOption("help")) {
        HelpFormatter hf = new HelpFormatter();
        hf.printHelp("astexte script", options);
    }
    if (cl.hasOption("folder") && cl.hasOption("file")) {
        launchWriteAndRead(cl.getOptionValue("folder"), cl.getOptionValue("file"));
        System.out.println("OK");

    } else {
        HelpFormatter hf = new HelpFormatter();
        hf.printHelp("astexte script", options);
    }
    launch(args);
}

From source file:com.wdt.java.ControlTool.java

public static void main(String[] args) {

    Options options = OptionControlClass.OptionControlClass();
    CommandLineParser parser = new GnuParser();
    CommandLine line = null;//from   w w w  .  j a  va2s .  c  o  m
    try {
        line = parser.parse(options, args);
    } catch (ParseException e) {
        LOG.log(Level.SEVERE, e.getMessage());
    }
    OptionControlClass.processArgsLogic(line, options);
}

From source file:com.eddy.malupdater.MalUpdater.java

public static void main(String args[]) {
    try {//w  w w.  j  a va 2s. com
        initMainLogger();
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
    } catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException
            | UnsupportedLookAndFeelException ex) {
        Logger.getLogger(MalUpdater.class.getName()).log(Level.SEVERE, null, ex);
    }

    java.awt.EventQueue.invokeLater(new Runnable() {
        @Override
        public void run() {
            form = new MalUpdaterForm();

            if (StringUtils.isEmpty(MyProperties.getUsername()) || MyProperties.getPassword().length <= 0) {
                CredentialsPanel credentialsPanel = CredentialsPanel.getInstance();
                credentialsPanel.setVisible(true);
            }
        }
    });
}

From source file:HTMLFormatter.java

public static void main(String args[]) throws Exception {
    LogManager lm = LogManager.getLogManager();
    Logger parentLogger, childLogger;
    FileHandler xml_handler = new FileHandler("log_output.xml");
    FileHandler html_handler = new FileHandler("log_output.html");
    parentLogger = Logger.getLogger("ParentLogger");
    childLogger = Logger.getLogger("ParentLogger.ChildLogger");

    lm.addLogger(parentLogger);/* w w  w  . j a v  a2 s . c om*/

    lm.addLogger(childLogger);

    parentLogger.setLevel(Level.WARNING);
    childLogger.setLevel(Level.ALL);
    xml_handler.setFormatter(new XMLFormatter());
    html_handler.setFormatter(new HTMLFormatter());

    parentLogger.addHandler(xml_handler);
    childLogger.addHandler(html_handler);

    childLogger.log(Level.FINE, "This is a fine log message");
    childLogger.log(Level.SEVERE, "This is a severe log message");
    xml_handler.close();
    html_handler.close();
}