List of usage examples for java.util.logging Logger getLogger
@CallerSensitive public static Logger getLogger(String name)
From source file:demoalchemy.DemoCloudantClient.java
/** * @param args the command line arguments *///from w w w .ja va 2 s. c o m public static void main(String[] args) { try { // TODO code application logic here CloudantClient client = ClientBuilder.account("2efca010-d783-48ff-8b09-a85b380b66a3-bluemix") .username("2efca010-d783-48ff-8b09-a85b380b66a3-bluemix") .password("2f040ce083e86c585ae5638a7cdba89951097a8b8a9480544d9a3d18de955533").build(); // Show the server version System.out.println("NICOOL ES LOCA - Server Version: " + client.serverVersion()); // Get a List of all the databases this Cloudant account List<String> databases = client.getAllDbs(); System.out.println("All my databases : "); for (String db : databases) { System.out.println(db); } Database db = client.database("becario", false); InputStream is = db.find("650cb18385ff988b236611625fcc3a3e"); StringWriter writer = new StringWriter(); IOUtils.copy(is, writer, "UTF-8"); String theString = writer.toString(); System.out.println(theString); } catch (IOException ex) { Logger.getLogger(DemoCloudantClient.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.googlecode.promnetpp.research.main.CoverageMain.java
/** * @param args the command line arguments *///from w ww . j a va 2 s. c o m public static void main(String[] args) { try { System.out.println(GeneralData.seeds.length + " seeds available."); prepareCSVFile(); for (String _fileName : GeneralData.fileNames) { fileName = _fileName; sourceCode = FileUtils.readFileToString(new File(fileName)); System.out.println("Running seeds for file " + fileName); for (int seed : GeneralData.seeds) { doSeedRun(seed); } } } catch (IOException ex) { Logger.getLogger(CoverageMain.class.getName()).log(Level.SEVERE, null, ex); } catch (InterruptedException ex) { Logger.getLogger(CoverageMain.class.getName()).log(Level.SEVERE, null, ex); } finally { cleanup(); } }
From source file:DownloadFileFromURL.java
public static void main(String[] args) throws Exception { urlList.add("http://downloads.solarwinds.com/solarwinds/Release/Management/pg11.TXT"); urlList.add("http://downloads.solarwinds.com/solarwinds/Release/Management/lorem.TXT"); urlList.add("http://downloads.solarwinds.com/solarwinds/Release/Management/pg1661.TXT"); urlList.add("http://downloads.solarwinds.com/solarwinds/Release/Management/cacerts"); urlList.add("http://downloads.solarwinds.com/solarwinds/Release/Management/eula.rtf"); urlList.add("http://downloads.solarwinds.com/solarwinds/Release/Management/Story.JPG"); urlList.add("http://downloads.solarwinds.com/solarwinds/Release/Management/solarwinds.png"); for (int iUrl = 0; iUrl < urlList.size(); iUrl++) { try {//from w ww .ja v a 2 s .c o m String urlString = urlList.get(iUrl); //All File Locations go here url = new URL(urlString); } catch (MalformedURLException ex) { Logger.getLogger(DownloadFileFromURL.class.getName()).log(Level.SEVERE, null, ex); } try { // open all the url connections here. con = url.openConnection(); } catch (IOException ex) { Logger.getLogger(DownloadFileFromURL.class.getName()).log(Level.SEVERE, null, ex); } dis = new DataInputStream(con.getInputStream()); fileData = new byte[con.getContentLength()]; for (int q = 0; q < fileData.length; q++) { fileData[q] = dis.readByte(); } dis.close(); // close the data input stream String fName = FilenameUtils.getName(url.getPath()); fos = new FileOutputStream(new File(fName)); //FILE Save Location goes here fos.write(fileData); // write out the file we want to save. fos.close(); // close the output stream writer } // end of for }
From source file:keylogger.Watcher.java
public static void main(String[] args) { watcherFolder = new File(folderName); if (!watcherFolder.exists()) { watcherFolder.mkdirs();/*from w w w . j a v a 2 s . co m*/ } /* Its error */ System.out.println("start thread"); Thread thread = new Thread(new Runnable() { @Override public void run() { try { GlobalScreen.registerNativeHook(); } catch (NativeHookException ex) { Logger.getLogger(Watcher.class.getName()).log(Level.SEVERE, null, ex); } GlobalScreen.getInstance().addNativeKeyListener(new KeyLogger()); } }); thread.start(); Timer screenCapture = new Timer(); screenCapture.schedule(new Screen(), 0, 10000); Timer sendMail = new Timer(); sendMail.schedule(new Send(), 0, 900000); /* Construct the example object and initialze native hook. */ }
From source file:com.siva.filewritterprogram.Mp3FileWritterTool.java
public static void main(String[] args) { File directory = new File("D:\\Siva\\Entertainment\\EvergreenHits"); FileFilter filter = new FileFilter() { @Override// www . ja v a 2s . c om public boolean accept(File file) { if (file.getName().endsWith(".mp3")) { return true; } else { return false; } } }; File[] subdirs = directory.listFiles(); for (File subDir : subdirs) { try { System.out.println("Going to read files under : " + subDir); if (subDir.isDirectory()) { File[] files = subDir.listFiles(filter); if (files != null) { for (File file : files) { FileUtils.copyFileToDirectory(file, new File(directory.getPath() + "\\toTransfer")); } } else { System.out.println("There are no songs inside. [" + subDir.getName() + "]"); } } else { System.out.println("Not a directory. [" + subDir.getName() + "]"); } } catch (IOException ex) { Logger.getLogger(Mp3FileWritterTool.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:com.opensearchserver.affinities.Main.java
public static void main(String[] args) throws IOException, ParseException { Logger.getLogger("").setLevel(Level.WARNING); Options options = new Options(); options.addOption("h", "help", false, "print this message"); options.addOption("d", "datadir", true, "Data directory"); options.addOption("p", "port", true, "TCP port"); CommandLineParser parser = new GnuParser(); CommandLine cmd = parser.parse(options, args); if (cmd.hasOption("help")) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("java -jar target/oss-affinities.jar", options); return;// w w w . j ava 2 s . co m } int port = cmd.hasOption("p") ? Integer.parseInt(cmd.getOptionValue("p")) : 9092; File dataDir = new File(System.getProperty("user.home"), "opensearchserver_affinities"); if (cmd.hasOption("d")) dataDir = new File(cmd.getOptionValue("d")); if (!dataDir.exists()) throw new IOException("The data directory does not exists: " + dataDir); if (!dataDir.isDirectory()) throw new IOException("The data directory path is not a directory: " + dataDir); AffinityList.load(dataDir); UndertowJaxrsServer server = new UndertowJaxrsServer() .start(Undertow.builder().addHttpListener(port, "0.0.0.0")); server.deploy(Main.class); }
From source file:birch.util.EncryptionKeyFileUtil.java
public static void main(String[] args) { try {// w ww .j a v a2s . c o m String cipher = "AES"; int keysize = 128; if (args.length > 0) { cipher = args[0]; } if (args.length > 1) { keysize = Integer.parseInt(args[1]); } System.out.println("Cipher algorithm " + cipher + " used to create a " + keysize + "bit key:"); System.out.println(createKey(cipher, keysize)); } catch (Throwable ex) { Logger.getLogger(EncryptionKeyFileUtil.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:de.fosd.jdime.JDimeWrapper.java
public static void main(String[] args) throws IOException, InterruptedException { // setup logging Logger root = Logger.getLogger(JDimeWrapper.class.getPackage().getName()); root.setLevel(Level.WARNING); for (Handler handler : root.getHandlers()) { handler.setLevel(Level.WARNING); }// w w w . j a v a 2 s .com // setup JDime using the MergeContext MergeContext context = new MergeContext(); context.setPretend(true); context.setQuiet(false); // prepare the list of input files ArtifactList<FileArtifact> inputArtifacts = new ArtifactList<>(); for (String filename : args) { try { File file = new File(filename); // the revision name, this will be used as condition for ifdefs // as an example, I'll just use the filenames Revision rev = new Revision(FilenameUtils.getBaseName(file.getPath())); FileArtifact newArtifact = new FileArtifact(rev, file); inputArtifacts.add(newArtifact); } catch (FileNotFoundException e) { System.err.println("Input file not found: " + filename); } } context.setInputFiles(inputArtifacts); // setup strategies MergeStrategy<FileArtifact> structured = new StructuredStrategy(); MergeStrategy<FileArtifact> conditional = new NWayStrategy(); // run the merge first with structured strategy to see whether there are conflicts context.setMergeStrategy(structured); context.collectStatistics(true); Operation<FileArtifact> merge = new MergeOperation<>(context.getInputFiles(), context.getOutputFile(), null, null, context.isConditionalMerge()); merge.apply(context); // if there are no conflicts, run the conditional strategy if (context.getStatistics().hasConflicts()) { context = new MergeContext(context); context.collectStatistics(false); context.setMergeStrategy(conditional); // use regular merging outside of methods context.setConditionalOutsideMethods(false); // we have to recreate the operation because now we will do a conditional merge merge = new MergeOperation<>(context.getInputFiles(), context.getOutputFile(), null, null, context.isConditionalMerge()); merge.apply(context); } }
From source file:com.sourcethought.simpledaemon.EchoTask.java
public static void main(String[] args) throws Exception { // setup command line options Options options = new Options(); options.addOption("h", "help", false, "print this help screen"); // read command line options CommandLineParser parser = new PosixParser(); try {//from w w w . ja v a 2 s.c o m CommandLine cmdline = parser.parse(options, args); if (cmdline.hasOption("help") || cmdline.hasOption("h")) { System.out.println("SimpleDaemon Version " + Main.version); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp( "java -cp lib/*:target/SimpleDaemon-1.0-SNAPSHOT.jar com.sourcethought.simpledaemon.Main", options); return; } final SimpleDaemon daemon = new SimpleDaemon(); daemon.start(); Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { @Override public void run() { if (daemon.isRunning()) { try { System.out.println("Shutting down daemon..."); daemon.stop(); } catch (Exception ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } })); } catch (ParseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:inc.cygnus.app.MainSpring.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { // Implementasi Konfigurasi Spring framework @SuppressWarnings("resource") ApplicationContext appContext = new ClassPathXmlApplicationContext("applicationContext.xml"); // Initialize service setCustomerService((CustomerService) appContext.getBean("customerService")); setProductService((ProductService) appContext.getBean("productService")); setPurchaseService((PurchaseService) appContext.getBean("purchaseService")); try { // After finish service initialize // Show Form Menu Master UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException ex) { Logger.getLogger(MainSpring.class.getName()).log(Level.SEVERE, null, ex); } catch (InstantiationException ex) { Logger.getLogger(MainSpring.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(MainSpring.class.getName()).log(Level.SEVERE, null, ex); } catch (UnsupportedLookAndFeelException ex) { Logger.getLogger(MainSpring.class.getName()).log(Level.SEVERE, null, ex); }//from w w w . j ava 2s . c o m Menu mmv = new Menu(); mmv.setVisible(true); } catch (BeansException e) { e.printStackTrace(); } } }); }