List of usage examples for java.util.logging Level INFO
Level INFO
To view the source code for java.util.logging Level INFO.
Click Source Link
From source file:pl.mariuszczarny.springbatchforslask.main.fromdb.RefereeImport.java
/** * @param args the command line arguments *//*from w w w.jav a2 s . com*/ public static void main(String[] args) { fLogger.log(Level.INFO, "Import referee csv from mysql"); String[] springConfig = { "spring/batch/config/database.xml", "spring/batch/config/context.xml", "spring/batch/jobs/fromdb/referee.xml" }; ApplicationContext context = new ClassPathXmlApplicationContext(springConfig); JobLauncher jobRefereeLauncher = (JobLauncher) context.getBean("jobLauncher"); Job refereeJob = (Job) context.getBean("refereeImportJob"); try { JobExecution execution = jobRefereeLauncher.run(refereeJob, new JobParameters()); fLogger.log(Level.INFO, "Exit Status : {0}", execution.getStatus()); } catch (JobParametersInvalidException e) { e.getMessage(); } catch (JobExecutionAlreadyRunningException e) { e.getMessage(); } catch (JobInstanceAlreadyCompleteException e) { e.getMessage(); } catch (JobRestartException e) { e.getMessage(); } fLogger.log(Level.INFO, "Done"); }
From source file:pl.mariuszczarny.springbatchforslask.main.fromdb.ContractImport.java
/** * @param args the command line arguments *//*from w ww . ja va 2s . c om*/ public static void main(String[] args) { fLogger.log(Level.INFO, "Import contract csv from mysql"); String[] springConfig = { "spring/batch/config/database.xml", "spring/batch/config/context.xml", "spring/batch/jobs/fromdb/contract.xml" }; ApplicationContext context = new ClassPathXmlApplicationContext(springConfig); JobLauncher jobContractLauncher = (JobLauncher) context.getBean("jobLauncher"); Job contractJob = (Job) context.getBean("contractImportJob"); try { JobExecution execution = jobContractLauncher.run(contractJob, new JobParameters()); fLogger.log(Level.INFO, "Exit Status : {0}", execution.getStatus()); } catch (JobParametersInvalidException e) { e.getMessage(); } catch (JobExecutionAlreadyRunningException e) { e.getMessage(); } catch (JobInstanceAlreadyCompleteException e) { e.getMessage(); } catch (JobRestartException e) { e.getMessage(); } fLogger.log(Level.INFO, "Done"); }
From source file:Person.java
public static void main(String args[]) { Logger logger = Logger.getLogger("your.logging"); AgeFilter filter = new AgeFilter(); logger.setFilter(filter);// ww w. ja v a 2 s .c o m Person person = new Person("YourName", 32); logger.log(Level.INFO, "Person has age " + person.getAge(), person); }
From source file:com.sociesc.findasmartphonespark.Main.java
public static void main(String[] args) { String apiPrefix = "api/v1/"; //setIpAddress("192.168.56.1"); setPort(9010);//ww w .j a va 2s .c o m try { Logger.getLogger(Main.class.getName()).log(Level.INFO, "Criando banco de dados"); DatabaseUtils.seedDatabase(); } catch (SQLException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } Dao<User> userDao = new Dao(User.class); get(apiPrefix + "/hello/:name", (request, response) -> { ObjectMapper objectMapper = new ObjectMapper(); /*ArrayList<AccessPoint> arrayAp = new ArrayList<AccessPoint>(); for (int i = 0; i < 10; i++) { AccessPoint ap = new AccessPoint(); ap.setBSSID("AP" + i); ap.setSSID("00:00:00:0" + i); ap.setRSSI(-50 + i); ap.setSala("Sala" + i); arrayAp.add(ap); //System.out.println("Nome: " + ap.getBSSID() + " - Mac: " + ap.getSSID() + " - Sinal: " + ap.getRSSI()); } String retornoJson = rwJson.writeJson(arrayAp);*/ //objectMapper.readValue(URLDecoder.decode(request.params(":name"), "UTF-8"), new TypeReference(String("lol"))); ArrayList<AccessPoint> arrayAp = null; try { arrayAp = rwJson.readJson(URLDecoder.decode(request.params(":name"), "UTF-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return arrayAp.get(0).getBSSID(); //return "Hello: " + request.params(":name"); //return arrayAp[0].get; }); post(apiPrefix + "/findUser/:data", (request, response) -> { String userId = request.params(":data"); ArrayList<AccessPoint> aps = rwJson.readJson(userId.toString()); /*JsonObject json = new JsonObject(); try { json = JsonObject.readFrom(request.params(":data")); } catch (Exception ex) { System.out.println("erro no json:\n" + ex.getMessage()); Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); json.add("error", ex.getMessage()); response.status(500); }*/ try { for (int i = 0; i < aps.size(); i++) { System.out.println("Nome: " + aps.get(i).getBSSID() + " - Mac: " + aps.get(i).getSSID() + " - Sinal: " + aps.get(i).getRSSI() + " - Sala: " + aps.get(i).getSala()); } } catch (Exception ex) { System.out.println("erro no json:\n" + ex.getMessage()); Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); //json.add("error", ex.getMessage()); response.status(500); return ex.getMessage(); } return userId.toString(); }); /*post(apiPrefix + "/findUser/", (request, response) ->{ JsonObject json = new JsonObject(); // Informaes do roteador/AP String[] BSSID; // basic service set identifier - nome da conexo String[] SSID; // service set identifier - identificador nico da conexo int[] RSSI; // received signal strength indicator - potencia do sinal (-87 a -32) String sala; String jsonBody = request.body(); JsonObject reqJson = JsonObject.readFrom(jsonBody); JsonObject wifiJson = reqJson.get("wifi").asObject(); System.out.println("reqJson.size()" + reqJson.size() + "\nwifiJson.size()" + wifiJson.size()); RSSI = new int[wifiJson.size()]; BSSID = new String[wifiJson.size()]; SSID = new String[wifiJson.size()]; try{ for (int i = 0; i < wifiJson.size(); i++) { // recebe informaes das conexes encontradas BSSID[i] = wifiJson.get("BSSID").asString(); SSID[i] = wifiJson.get("SSID").asString(); RSSI[i] = wifiJson.get("RSSI").asInt(); } return json.toString(); }catch(Exception ex){ System.out.println("erro no json:\n" + ex.getMessage()); Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); json.add("error", ex.getMessage()); response.status(500); } return json.toString(); });*/ get(apiPrefix + "/users", (request, response) -> { JsonObject json = new JsonObject(); request.params(); try { List<User> users = userDao.findAll(); JsonArray usersJson = new JsonArray(); for (User u : users) { JsonObject uJson = new JsonObject(); uJson.add("id", u.getId()); uJson.add("name", u.getName()); uJson.add("email", u.getEmail()); usersJson.add(uJson); } json.add("users", usersJson); } catch (SQLException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); json.add("error", ex.getMessage()); response.status(500); } return json.toString(); }); /*get(apiPrefix + "/users/:id", (request, response) -> { Long userId = Long.parseLong(request.params(":id")); JsonObject json = new JsonObject(); try{ User user = userDao.findById(userId); if(user == null){ json.add("error", "user not found"); response.status(404); return json.toString(); } JsonObject userJson = new JsonObject(); userJson.add("id", user.getId()); userJson.add("name", user.getName()); userJson.add("email", user.getEmail()); json.add("user", userJson); return json.toString(); }catch(Exception ex){ Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); json.add("error", ex.getMessage()); response.status(500); } return json.toString(); });*/ delete(apiPrefix + "/users/:id", (request, response) -> { Long userId = Long.parseLong(request.params(":id")); JsonObject json = new JsonObject(); try { userDao.removeById(userId); json.add("message", "user removed"); response.status(200); return json.toString(); } catch (Exception ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); json.add("error", ex.getMessage()); response.status(500); } return json.toString(); }); put(apiPrefix + "/users/:id", (request, response) -> { Long userId = Long.parseLong(request.params(":id")); JsonObject json = new JsonObject(); try { String jsonBody = request.body(); JsonObject reqJson = JsonObject.readFrom(jsonBody); JsonObject userJson = reqJson.get("user").asObject(); String name = userJson.get("name") != null ? userJson.get("name").asString() : null; String email = userJson.get("email") != null ? userJson.get("email").asString() : null; String password = userJson.get("password") != null ? userJson.get("password").asString() : null; User user = userDao.findById(userId); if (name != null) user.setName(name); if (email != null) user.setEmail(email); if (password != null) { String passwordDigest = DatabaseUtils.criptPass(password); user.setPasswordDigest(passwordDigest); } userDao.update(user); JsonObject resUserJson = new JsonObject(); resUserJson.add("id", user.getId()); resUserJson.add("name", user.getName()); resUserJson.add("email", user.getEmail()); json.add("user", resUserJson); return json.toString(); } catch (Exception ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); json.add("error", ex.getMessage()); response.status(500); } return json.toString(); }); post(apiPrefix + "/users", (request, response) -> { JsonObject json = new JsonObject(); try { String jsonBody = request.body(); JsonObject reqJson = JsonObject.readFrom(jsonBody); JsonObject userJson = reqJson.get("user").asObject(); User user = new User(); user.setName(userJson.get("name").asString()); user.setEmail(userJson.get("email").asString()); user.setPasswordDigest(DatabaseUtils.criptPass("tempPass")); userDao.create(user); JsonObject resUserJson = new JsonObject(); resUserJson.add("id", user.getId()); resUserJson.add("name", user.getName()); resUserJson.add("email", user.getEmail()); resUserJson.add("passwordDigest", user.getPasswordDigest()); json.add("user", resUserJson); return json.toString(); } catch (Exception ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); json.add("error", ex.getMessage()); response.status(500); } return json.toString(); }); }
From source file:to.sparks.mtgox.example.HowToGetInfo.java
public static void main(String[] args) throws Exception { // Obtain a $USD instance of the API ApplicationContext context = new ClassPathXmlApplicationContext("to/sparks/mtgox/example/Beans.xml"); MtGoxHTTPClient mtgoxUSD = (MtGoxHTTPClient) context.getBean("mtgoxUSD"); Lag lag = mtgoxUSD.getLag();//from w w w. j av a2s . c om logger.log(Level.INFO, "Current lag: {0}", lag.getLag()); Ticker ticker = mtgoxUSD.getTicker(); logger.log(Level.INFO, "Last price: {0}", ticker.getLast().toPlainString()); // Get the private account info AccountInfo info = mtgoxUSD.getAccountInfo(); logger.log(Level.INFO, "Logged into account: {0}", info.getLogin()); Order[] openOrders = mtgoxUSD.getOpenOrders(); if (ArrayUtils.isNotEmpty(openOrders)) { for (Order order : openOrders) { logger.log(Level.INFO, "Open order: {0} status: {1} price: {2}{3} amount: {4}", new Object[] { order.getOid(), order.getStatus(), order.getCurrency().getCurrencyCode(), order.getPrice().getDisplay(), order.getAmount().getDisplay() }); } } else { logger.info("There are no currently open bid or ask orders."); } }
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();//from www . ja v a2 s . 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:groovesquid.Main.java
public static void main(String[] args) { System.setSecurityManager(null); log.log(Level.INFO, "Groovesquid v{0} running on {1} {2} ({3}) in {4}", new Object[] { version, System.getProperty("java.vm.name"), System.getProperty("java.runtime.version"), System.getProperty("java.vm.vendor"), System.getProperty("java.home") }); // show gui/* ww w . java 2s . co m*/ // apple os x System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Groovesquid"); // antialising System.setProperty("awt.useSystemAAFontSettings", "lcd"); System.setProperty("swing.aatext", "true"); // flackering bg fix System.setProperty("sun.awt.noerasebackground", "true"); System.setProperty("sun.java2d.noddraw", "true"); Toolkit.getDefaultToolkit().setDynamicLayout(true); try { //UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { log.log(Level.SEVERE, null, ex); } // load languages languages = loadLanguages(); // Load config config = loadConfig(); // GUI try { gui = (GUI) config.getGuiClass().newInstance(); } catch (InstantiationException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } settings = new Settings(); about = new About(); // Update Checker new UpdateCheckThread().start(); // init grooveshark (every 25min) new InitThread().start(); }
From source file:to.sparks.mtgox.example.PlaceOrders.java
public static void main(String[] args) throws Exception { // Obtain a $USD instance of the API ApplicationContext context = new ClassPathXmlApplicationContext("to/sparks/mtgox/example/Beans.xml"); MtGoxHTTPClient mtgoxUSD = (MtGoxHTTPClient) context.getBean("mtgoxUSD"); // Obtain information about the base currency of the API instance CurrencyInfo currencyInfo = mtgoxUSD.getCurrencyInfo(mtgoxUSD.getBaseCurrency()); logger.log(Level.INFO, "Base currency: {0}", currencyInfo.getCurrency().getCurrencyCode()); // Purchase 1.0 bitcoins for USD$0.01 MtGoxFiatCurrency fiatUnit = new MtGoxFiatCurrency(0.01D, currencyInfo); // We use the currencyInfo to be explicit about what this money represents MtGoxBitcoin bitcoinUnit = new MtGoxBitcoin(1.0D); // You should probably use BigDecimals instead of double types to represent money. String orderRef = mtgoxUSD.placeOrder(MtGoxHTTPClient.OrderType.Bid, fiatUnit, bitcoinUnit); logger.log(Level.INFO, "orderRef: {0}", new Object[] { orderRef }); // Cancel the order mtgoxUSD.cancelOrder(MtGoxHTTPClient.OrderType.Bid, orderRef); }
From source file:com.mmone.gpdati.allotment.reader.AllotmentFileReader.java
public static void main(String[] args) { try {/*from www . ja v a 2 s . c om*/ AllotmentLineProvvider afr = new AllotmentFileReader( "C:/svnprjects/mauro_netbprj/abs-ota-soapui-listener/test/FILE_DISPO__20160616.txt"); List<String> l = afr.getLines(); for (String s : l) { System.out.println(s); } } catch (FileNotFoundException ex) { Logger.getLogger(AllotmentFileReader.class.getName()).log(Level.INFO, "skipping sync " + ex.getMessage()); } catch (Exception ex) { Logger.getLogger(AllotmentFileReader.class.getName()).log(Level.INFO, "skipping sync " + ex.getMessage()); Logger.getLogger(AllotmentFileReader.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.googlecode.jgenhtml.JGenHtml.java
/** * Run jgenhtml./*from ww w. j a v a2 s .c o m*/ * @param argv Arguments (viewable by running with -h switch). */ public static void main(final String[] argv) { Config config = new Config(); try { config.initializeUserPrefs(argv); if (config.isHelp()) { config.showCmdLineHelp(); } else if (config.isVersion()) { System.out.println("jgenhtml version " + VERSION); } else { String[] traceFiles = config.getTraceFiles(); if (traceFiles.length > 0) { CoverageReport.setConfig(config); CoverageReport coverageReport = new CoverageReport(traceFiles); if (coverageReport.getPageCount() > 0) { LOGGER.log(Level.INFO, "Found {0} entries.", coverageReport.getPageCount()); coverageReport.generateReports(); } } else { LOGGER.log(Level.INFO, "jgenhtml: No filename specified"); LOGGER.log(Level.INFO, "Use jgenhtml --help to get usage information"); } } } catch (IOException ex) { LOGGER.log(Level.SEVERE, null, ex); } catch (ParserConfigurationException ex) { LOGGER.log(Level.SEVERE, null, ex); } catch (ParseException ex) { LOGGER.log(Level.WARNING, ex.getLocalizedMessage()); } }