List of usage examples for java.util.logging Logger getLogger
@CallerSensitive public static Logger getLogger(String name)
From source file:interfaceTisseoWS.ST1.java
/** * @param args the command line arguments *///w ww . jav a 2s .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(ST1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(ST1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(ST1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(ST1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { try { new ST1().setVisible(true); } catch (ParseException ex) { Logger.getLogger(ST1.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(ST1.class.getName()).log(Level.SEVERE, null, ex); } catch (URISyntaxException ex) { Logger.getLogger(ST1.class.getName()).log(Level.SEVERE, null, ex); } } }); }
From source file:Main.java
public static boolean writeXMLFile(String outFileName, String xmlFile) { BufferedWriter writer;// w w w . j a v a 2 s . c om try { writer = new BufferedWriter(new FileWriter(outFileName, false)); writer.write(xmlFile); writer.close(); return true; } catch (IOException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); return false; } }
From source file:glass.Plugins.utils.java
public static void cleanWorkDir(String output_folder) { new File(output_folder).mkdirs();//create if does not exist try {/* w ww . j a v a2s. c om*/ FileUtils.deleteDirectory(new File(output_folder)); } catch (IOException ex) { Logger.getLogger(ServerLogPlugin.class.getName()).log(Level.SEVERE, null, ex); ex.printStackTrace(); } new File(output_folder).mkdirs();//create if does not exist }
From source file:net.sf.maltcms.chromaui.charts.GradientPaintScale.java
/** * * @param args//from w w w. j a v a 2s . co m */ public static void main(String[] args) { double[] st = ImageTools.createSampleTable(256); Logger.getLogger(GradientPaintScale.class.getName()).info(Arrays.toString(st)); double min = 564.648; double max = 24334.234; GradientPaintScale gps = new GradientPaintScale(st, min, max, new Color[] { Color.BLACK, Color.RED, Color.orange, Color.yellow, Color.white }); double val = min; double incr = (max - min) / (st.length - 1); Logger.getLogger(GradientPaintScale.class.getName()).log(Level.INFO, "Increment: {0}", incr); for (int i = 0; i < st.length; i++) { Logger.getLogger(GradientPaintScale.class.getName()).log(Level.INFO, "Value: {0}", val); gps.getPaint(val); val += incr; } Logger.getLogger(GradientPaintScale.class.getName()).info("Printing min and max values"); Logger.getLogger(GradientPaintScale.class.getName()).log(Level.INFO, "Min: {0} gps min: {1}", new Object[] { min, gps.getPaint(min) }); Logger.getLogger(GradientPaintScale.class.getName()).log(Level.INFO, "Max: {0} gps max: {1}", new Object[] { max, gps.getPaint(max) }); JList jl = new JList(); DefaultListModel dlm = new DefaultListModel(); jl.setModel(dlm); jl.setCellRenderer(new ListCellRenderer() { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (value instanceof JLabel) { // Border b = // BorderFactory.createCompoundBorder(BorderFactory // .createEmptyBorder(0, 0, 5, 0), BorderFactory // .createLineBorder(Color.BLACK, 1)); // ((JLabel) value).setBorder(b); return (Component) value; } return new JLabel(value.toString()); } }); JFrame jf = new JFrame(); jf.add(new JScrollPane(jl)); jf.setVisible(true); jf.setSize(200, 400); for (int alpha = -10; alpha <= 10; alpha++) { for (int beta = 1; beta <= 20; beta++) { gps.setAlphaBeta(alpha, beta); // System.out.println(Arrays.toString(gps.st)); // System.out.println(Arrays.toString(gps.sampleTable)); BufferedImage bi = gps.getLookupImage(); ImageIcon ii = new ImageIcon(bi); dlm.addElement(new JLabel(ii)); } } }
From source file:blink.KeepAlive.java
private static String createKeepAliveJSON() { JSONObject json = new JSONObject(); try {// w w w .j av a 2 s . c o m json.put("type", "keep-alive"); } catch (JSONException ex) { Logger.getLogger(KeepAlive.class.getName()).log(Level.SEVERE, null, ex); } return json.toString(); }
From source file:com.mafia.server.util.JacksonUtils.java
public static String objectToString(Object t) { try {//from w w w . j a v a2s . c o m ObjectMapper objectMapper = new ObjectMapper(); return objectMapper.writeValueAsString(t); } catch (JsonProcessingException ex) { Logger.getLogger(JacksonUtils.class.getName()).log(Level.SEVERE, null, ex); } return null; }
From source file:deincraftlauncher.IO.download.FTPConnection.java
public static void changeDir(String dir) { try {/*from w ww .j av a 2 s. co m*/ client.changeWorkingDirectory(dir); } catch (IOException ex) { Logger.getLogger(FTPConnection.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:jsonbrowse.JsonBrowse.java
/** * @param args the command line arguments *///from w w w . j a v a2s . c om 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 | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(JsonBrowse.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> String fileName; // Get name of JSON file Path jsonFilePath; if (args.length < 1) { JFileChooser fc = new JFileChooser(System.getProperty("user.dir")); fc.setDialogTitle("Select JSON file..."); fc.setFileFilter(new FileNameExtensionFilter("JSON files (*.json/*.txt)", "json", "txt")); if ((fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION)) { jsonFilePath = fc.getSelectedFile().toPath().toAbsolutePath(); } else { return; } } else { Path path = Paths.get(args[0]); if (!path.isAbsolute()) jsonFilePath = Paths.get(System.getProperty("user.dir")).resolve(path); else jsonFilePath = path; } // Run app try { JsonBrowse app = new JsonBrowse(jsonFilePath); app.setVisible(true); } catch (FileNotFoundException ex) { System.out.println("Input file '" + jsonFilePath + "' not found."); System.exit(1); } catch (IOException ex) { System.out.println("Error reading from file '" + jsonFilePath + "'."); System.exit(1); } catch (InterruptedException ex) { Logger.getLogger(JsonBrowse.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:Main.java
public static String convertStringToMd5(String valor) { MessageDigest mDigest;/*ww w .j a v a 2 s .c om*/ StringBuffer sb; if (valor == "") { return null; } try { mDigest = MessageDigest.getInstance("MD5"); byte[] valorMD5 = mDigest.digest(valor.getBytes("UTF-8")); sb = new StringBuffer(); for (byte b : valorMD5) { sb.append(Integer.toHexString((b & 0xFF) | 0x100).substring(1, 3)); } return sb.toString(); } catch (NoSuchAlgorithmException | UnsupportedEncodingException ex) { Logger.getLogger(MessageDigest.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(StringBuffer.class.getName()).log(Level.SEVERE, null, ex); return null; } }
From source file:com.espe.distribuidas.protocolocajero.pc.Originador.java
public static String getOriginador(String c) { String origen = ""; try {// w ww. j ava2 s . c o m InetAddress localHost = InetAddress.getLocalHost(); origen = localHost.getHostAddress(); } catch (UnknownHostException ex) { Logger.getLogger(Originador.class.getName()).log(Level.SEVERE, null, ex); } origen = origen + "@" + c; origen = StringUtils.rightPad(origen, 20, "0"); return origen; }