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:edu.usf.cutr.HomeController.java
/** * Returns trip-updates in protocol buffer format *//*from www . jav a2 s. c o m*/ @RequestMapping(value = "/trip-updates.do", method = RequestMethod.GET) public void tripUdates(HttpServletRequest request, HttpServletResponse response) { try { logger.log(Level.INFO, "loading trips"); String path = UrlUtils.getResourcePath(request, URLConstants.TRIPS_NAME); createStaticProtoBufFile(response, path); } catch (IOException e) { e.printStackTrace(); } }
From source file:org.cloudifysource.azure.CliAzureDeploymentTest.java
private static void log(String message) { logger.log(Level.INFO, message); }
From source file:org.eclipse.dirigible.cli.apis.ImportProjectAPI.java
private static void executeRequest(CloseableHttpClient httpClient, HttpPost postRequest) throws IOException, ClientProtocolException { try {/* w ww .j a v a2 s . c o m*/ CloseableHttpResponse response = httpClient.execute(postRequest); try { logger.log(Level.INFO, "----------------------------------------"); logger.log(Level.INFO, response.getStatusLine().toString()); HttpEntity resultEntity = response.getEntity(); if (resultEntity != null) { logger.log(Level.INFO, "Response content length: " + resultEntity.getContentLength()); } EntityUtils.consume(resultEntity); } finally { response.close(); } } finally { httpClient.close(); } }
From source file:jshm.logging.Log.java
public static void reloadConfig() throws Exception { // all logging Handler consoleHandler = new ConsoleHandler(); consoleHandler.setLevel(DEBUG ? Level.ALL : Level.WARNING); consoleHandler.setFormatter(new OneLineFormatter()); Logger cur = Logger.getLogger(""); removeHandlers(cur);//from w ww . java2s. c o m cur.addHandler(consoleHandler); // jshm logging Formatter fileFormatter = new FileFormatter(); Handler jshmHandler = new FileHandler("data/logs/JSHManager.txt"); jshmHandler.setLevel(Level.ALL); jshmHandler.setFormatter(fileFormatter); cur = Logger.getLogger("jshm"); cur.addHandler(jshmHandler); cur.setLevel(DEBUG ? Level.ALL : Level.INFO); // hibernate logging Handler hibernateHandler = new FileHandler("data/logs/Hibernate.txt"); hibernateHandler.setLevel(Level.ALL); hibernateHandler.setFormatter(fileFormatter); cur = Logger.getLogger("org.hibernate"); removeHandlers(cur); cur.addHandler(hibernateHandler); cur.setLevel(DEBUG ? Level.INFO : Level.WARNING); // HttpClient logging Handler httpClientHandler = new FileHandler("data/logs/HttpClient.txt"); httpClientHandler.setLevel(Level.ALL); httpClientHandler.setFormatter(fileFormatter); // cur = Logger.getLogger("httpclient.wire"); cur = Logger.getLogger("httpclient.wire.header"); removeHandlers(cur); cur.addHandler(httpClientHandler); cur.setLevel(DEBUG ? Level.ALL : Level.INFO); cur = Logger.getLogger("org.apache.commons.httpclient"); removeHandlers(cur); cur.addHandler(httpClientHandler); cur.setLevel(DEBUG ? Level.FINER : Level.INFO); // HtmlParser logging Handler htmlParserHandler = new FileHandler("data/logs/HtmlParser.txt"); htmlParserHandler.setLevel(Level.ALL); htmlParserHandler.setFormatter(fileFormatter); cur = Logger.getLogger("org.htmlparser"); removeHandlers(cur); cur.addHandler(htmlParserHandler); cur.setLevel(DEBUG ? Level.ALL : Level.INFO); // SwingX logging Handler swingxHandler = new FileHandler("data/logs/SwingX.txt"); swingxHandler.setLevel(Level.ALL); swingxHandler.setFormatter(fileFormatter); cur = Logger.getLogger("org.jdesktop.swingx"); removeHandlers(cur); cur.addHandler(swingxHandler); cur.setLevel(DEBUG ? Level.ALL : Level.INFO); }
From source file:ca.craigthomas.visualclassifier.commandline.TrainCommand.java
/** * Load the data from a CSV file./* w w w . j ava2 s . co m*/ */ public void loadFromCSV() { mDataSet = new DataSet(true); try { mDataSet.addFromCSVFile(arguments.csvFile); LOGGER.log(Level.INFO, "loaded " + mDataSet.getNumSamples() + " sample(s)"); } catch (IOException e) { LOGGER.log(Level.SEVERE, e.getMessage()); mDataSet = null; } }
From source file:com.samir.commons.java.jarinstallerkit.jarinstaller.JarInstaller.java
public void moveFile(String origin, String destiny) throws Exception { LOGGER.log(Level.INFO, String.format("Moving from %s to %s", origin, destiny)); final File fileOrigin = new File(origin); final File fileDestiny = new File(destiny); FileUtils.copyFile(fileOrigin, fileDestiny); fileOrigin.delete();/*ww w .j a v a 2 s. c o m*/ }
From source file:com.sifiso.yazisa.util.PhotoUtil.java
public ResponseDTO downloadPhotos(HttpServletRequest request, PlatformUtil platformUtil) throws FileUploadException { logger.log(Level.INFO, "######### starting PHOTO DOWNLOAD process\n\n"); ResponseDTO resp = new ResponseDTO(); InputStream stream = null;/*from ww w . ja v a2s .c o m*/ File rootDir; try { rootDir = YazisaProperties.getImageDir(); logger.log(Level.INFO, "rootDir - {0}", rootDir.getAbsolutePath()); if (!rootDir.exists()) { rootDir.mkdir(); } } catch (Exception ex) { logger.log(Level.SEVERE, "Properties file problem", ex); resp.setMessage("Server file unavailable. Please try later"); resp.setStatusCode(114); return resp; } PhotoUploadDTO dto = null; Gson gson = new Gson(); File schoolDir = null, classDir = null, parentDir = null, teacherDir = null, studentDir = null; try { ServletFileUpload upload = new ServletFileUpload(); FileItemIterator iter = upload.getItemIterator(request); while (iter.hasNext()) { FileItemStream item = iter.next(); String name = item.getFieldName(); stream = item.openStream(); if (item.isFormField()) { if (name.equalsIgnoreCase("JSON")) { String json = Streams.asString(stream); if (json != null) { logger.log(Level.INFO, "picture with associated json: {0}", json); dto = gson.fromJson(json, PhotoUploadDTO.class); if (dto != null) { if (dto.getSchoolID() > 0) { schoolDir = createSchoolDirectory(rootDir, schoolDir, dto.getSchoolID()); } if (dto.getClassID() > 0) { classDir = createClassDirectory(schoolDir, classDir, dto.getClassID()); } if (dto.getParentID() > 0) { parentDir = createParentDirectory(schoolDir, parentDir); } if (dto.getTeacherID() > 0) { teacherDir = createTeacherDirectory(schoolDir, teacherDir); } if (dto.getStudentID() > 0) { studentDir = createStudentDirectory(rootDir, studentDir); } } } else { logger.log(Level.WARNING, "JSON input seems pretty fucked up! is NULL.."); } } } else { File imageFile = null; if (dto == null) { continue; } DateTime dt = new DateTime(); String fileName = ""; if (dto.isIsFullPicture()) { fileName = "f" + dt.getMillis() + ".jpg"; } else { fileName = "t" + dt.getMillis() + ".jpg"; } if (dto.getSchoolID() != null) { if (dto.isIsFullPicture()) { fileName = "f" + dto.getSchoolID() + ".jpg"; } else { fileName = "t" + dto.getSchoolID() + ".jpg"; } } if (dto.getSchoolID() != null) { if (dto.getTeacherID() != null) { if (dto.isIsFullPicture()) { fileName = "f" + dto.getTeacherID() + ".jpg"; } else { fileName = "t" + dto.getTeacherID() + ".jpg"; } } } if (dto.getSchoolID() != null) { if (dto.getClassID() != null) { if (dto.isIsFullPicture()) { fileName = "f" + dto.getClassID() + "-" + new Date().getYear() + ".jpg"; } else { fileName = "t" + dto.getClassID() + "-" + new Date().getYear() + ".jpg"; } } } if (dto.getSchoolID() != null) { if (dto.getParentID() != null) { if (dto.isIsFullPicture()) { fileName = "f" + dto.getParentID() + ".jpg"; } else { fileName = "t" + dto.getParentID() + ".jpg"; } } } if (dto.getStudentID() != null) { if (dto.isIsFullPicture()) { fileName = "f" + dto.getStudentID() + ".jpg"; } else { fileName = "t" + dto.getStudentID() + ".jpg"; } } // switch (dto.getPictureType()) { case PhotoUploadDTO.SCHOOL_IMAGE: imageFile = new File(schoolDir, fileName); break; case PhotoUploadDTO.CLASS_IMAGE: imageFile = new File(classDir, fileName); break; case PhotoUploadDTO.PARENT_IMAGE: imageFile = new File(parentDir, fileName); break; case PhotoUploadDTO.STUDENT_IMAGE: imageFile = new File(studentDir, fileName); break; } writeFile(stream, imageFile); resp.setStatusCode(0); resp.setMessage("Photo downloaded from mobile app "); //add database System.out.println("filepath: " + imageFile.getAbsolutePath()); //create uri /*int index = imageFile.getAbsolutePath().indexOf("monitor_images"); if (index > -1) { String uri = imageFile.getAbsolutePath().substring(index); System.out.println("uri: " + uri); dto.setUri(uri); } dto.setDateUploaded(new Date()); if (dto.isIsFullPicture()) { dto.setThumbFlag(null); } else { dto.setThumbFlag(1); } dataUtil.addPhotoUpload(dto);*/ } } } catch (FileUploadException | IOException | JsonSyntaxException ex) { logger.log(Level.SEVERE, "Servlet failed on IOException, images NOT uploaded", ex); throw new FileUploadException(); } return resp; }
From source file:lh.api.showcase.server.lh.api.referencedata.ReferenceDataRequestFactoryImplTest.java
@Test public void shouldConstructCountriesRequestUri() { ReferenceDataRequestFactoryImpl reqFact = new ReferenceDataRequestFactoryImpl(); try {/* w w w . j av a2 s. co m*/ URI constructedUri = reqFact.getRequestUri((NameValuePair) new BasicNameValuePair("countries", "DK"), null, Arrays.asList((NameValuePair) new BasicNameValuePair("lang", "EN"))); URI referenceUri = new URI("https://api.lufthansa.com/v1/references/countries/DK?lang=EN"); logger.log(Level.INFO, "constructed: " + constructedUri.toString()); logger.log(Level.INFO, "reference: " + referenceUri.toString()); assertTrue(referenceUri.equals(constructedUri)); } catch (URISyntaxException e) { assertTrue(false); } }
From source file:com.shin1ogawa.appengine.marketplace.controller.ConfigureForAdminController.java
@Override protected Navigation setUp() { domain = asString("domain"); if (StringUtils.isEmpty(domain)) { return redirect(Configuration.get().getMarketplaceListingUrl()); }/*from w w w .j a v a 2 s . c o m*/ UserService us = UserServiceFactory.getUserService(); if (us.isUserLoggedIn() == false) { // if user had not been authenticated then send redirect to login url. String callbackURL = request.getRequestURL() + "?domain=" + domain; logger.log(Level.INFO, "had not been authenticated: callback=" + callbackURL); return redirect(us.createLoginURL(callbackURL, domain, "https://www.google.com/accounts/o8/site-xrds?hd=" + domain, null)); } if (StringUtils.contains(us.getCurrentUser().getFederatedIdentity(), domain) == false) { // if user had been authenticated but invalid domain then send redirect to logout url. String callbackURL = request.getRequestURL() + "?domain=" + domain; logger.log(Level.INFO, "invalid domain: callback=" + callbackURL); return redirect(us.createLogoutURL(callbackURL, domain)); } delegate = IncreaseURLFetchDeadlineDelegate.install(); NamespaceManager.set(domain); return super.setUp(); }
From source file:net.chwise.websearch.Mol2SmilesServlet.java
@Override public void service(HttpServletRequest req, HttpServletResponse resp) throws IOException { String mol = req.getParameter("mol"); ToSmilesConverter converter = new ToSmilesConverter(); String smiles = converter.convert(mol); JSONObject jsonDoc = new JSONObject(); LOGGER.log(Level.INFO, "Molfile to convert: {0}", mol); try {/*ww w .j a v a2 s .c om*/ jsonDoc.put("smiles", smiles); } catch (JSONException e) { throw new RuntimeException("Exception in Mol2SmilesServlet", e); } resp.setContentType("application/json"); PrintWriter out = resp.getWriter(); out.print(jsonDoc); out.flush(); }