List of usage examples for java.util.logging Level FINE
Level FINE
To view the source code for java.util.logging Level FINE.
Click Source Link
From source file:io.trivium.Registry.java
public void reload() { final String PREFIX = "META-INF/services/"; ClassLoader tvmLoader = ClassLoader.getSystemClassLoader(); //types//from ww w . j a v a2 s. c o m try { Enumeration<URL> resUrl = tvmLoader.getResources(PREFIX + "io.trivium.extension.Fact"); while (resUrl.hasMoreElements()) { URL url = resUrl.nextElement(); URLConnection connection = url.openConnection(); connection.connect(); InputStream is = connection.getInputStream(); List<String> lines = IOUtils.readLines(is, "UTF-8"); is.close(); for (String line : lines) { Class<? extends Fact> clazz = (Class<? extends Fact>) Class.forName(line); Fact prototype = clazz.newInstance(); if (!types.containsKey(prototype.getTypeRef())) { types.put(prototype.getTypeRef(), clazz); } logger.log(Level.FINE, "registered type {0}", prototype.getFactName()); } } } catch (Exception ex) { logger.log(Level.SEVERE, "dynamically loading types failed", ex); } //bindings try { Enumeration<URL> resUrl = tvmLoader.getResources(PREFIX + "io.trivium.extension.Binding"); while (resUrl.hasMoreElements()) { URL url = resUrl.nextElement(); URLConnection connection = url.openConnection(); connection.connect(); InputStream is = connection.getInputStream(); List<String> lines = IOUtils.readLines(is, "UTF-8"); is.close(); for (String line : lines) { Class<? extends Binding> clazz = (Class<? extends Binding>) Class.forName(line); Binding prototype = clazz.newInstance(); if (!bindings.containsKey(prototype.getTypeRef())) { bindings.put(prototype.getTypeRef(), clazz); //register prototype bindingInstances.put(prototype.getTypeRef(), prototype); } logger.log(Level.FINE, "registered binding {0}", prototype.getName()); } } } catch (Exception ex) { logger.log(Level.SEVERE, "dynamically loading bindings failed", ex); } //tasks try { Enumeration<URL> resUrl = tvmLoader.getResources(PREFIX + "io.trivium.extension.Task"); while (resUrl.hasMoreElements()) { URL url = resUrl.nextElement(); URLConnection connection = url.openConnection(); connection.connect(); InputStream is = connection.getInputStream(); List<String> lines = IOUtils.readLines(is, "UTF-8"); is.close(); for (String line : lines) { Class<? extends Task> clazz = (Class<? extends Task>) Class.forName(line); Task prototype = clazz.newInstance(); if (!tasks.containsKey(prototype.getTypeRef())) { tasks.put(prototype.getTypeRef(), clazz); } logger.log(Level.FINE, "registered binding {0}", prototype.getName()); } } } catch (Exception ex) { logger.log(Level.SEVERE, "dynamically loading bindings failed", ex); } //testcases try { Enumeration<URL> resUrl = tvmLoader.getResources(PREFIX + "io.trivium.test.TestCase"); while (resUrl.hasMoreElements()) { URL url = resUrl.nextElement(); URLConnection connection = url.openConnection(); connection.connect(); InputStream is = connection.getInputStream(); List<String> lines = IOUtils.readLines(is, "UTF-8"); is.close(); for (String line : lines) { Class<? extends TestCase> clazz = (Class<? extends TestCase>) Class.forName(line); TestCase prototype = clazz.newInstance(); if (!testcases.containsKey(prototype.getTypeRef())) { testcases.put(prototype.getTypeRef(), prototype); } logger.log(Level.FINE, "registered testcase {0}", prototype.getTypeRef()); } } } catch (Exception ex) { logger.log(Level.SEVERE, "dynamically loading test cases failed", ex); } }
From source file:org.cogsurv.cogsurver.http.AbstractHttpApi.java
public CogSurvType executeHttpRequest(HttpRequestBase httpRequest, Parser<? extends CogSurvType> parser) throws CogSurvCredentialsException, CogSurvParseException, CogSurvException, IOException { if (DEBUG)/*from w w w .j a v a2 s . co m*/ LOG.log(Level.FINE, "doHttpRequest: " + httpRequest.getURI()); HttpResponse response = executeHttpRequest(httpRequest); if (DEBUG) LOG.log(Level.FINE, "executed HttpRequest for: " + httpRequest.getURI().toString()); int statusCode = response.getStatusLine().getStatusCode(); switch (statusCode) { case 200: InputStream is = response.getEntity().getContent(); try { return parser.parse(AbstractParser.createXmlPullParser(is)); } finally { is.close(); } case 201: is = response.getEntity().getContent(); try { return parser.parse(AbstractParser.createXmlPullParser(is)); } finally { is.close(); } case 401: response.getEntity().consumeContent(); if (DEBUG) LOG.log(Level.FINE, "HTTP Code: 401"); throw new CogSurvCredentialsException(response.getStatusLine().toString()); case 404: response.getEntity().consumeContent(); throw new CogSurvException(response.getStatusLine().toString()); case 500: response.getEntity().consumeContent(); if (DEBUG) LOG.log(Level.FINE, "HTTP Code: 500"); throw new CogSurvException("Foursquare is down. Try again later."); default: if (DEBUG) LOG.log(Level.FINE, "Default case for status code reached: " + response.getStatusLine().toString()); response.getEntity().consumeContent(); throw new CogSurvException("Error connecting to Foursquare: " + statusCode + ". Try again later."); } }
From source file:edu.usu.sdl.openstorefront.service.manager.MailManager.java
public static void send(Email email) { if (email != null) { if (mailer != null) { mailer.sendMail(email);/*w w w . j a v a 2 s .com*/ } else { StringBuilder sb = new StringBuilder(); for (Recipient recipient : email.getRecipients()) { sb.append(recipient.getType()).append(": "); sb.append(recipient.getAddress()).append(", "); } log.log(Level.FINE, MessageFormat.format("(Mock Email Handler) Sending Message Subject: {0} To {1}", new Object[] { email.getSubject(), sb.toString() })); } } else { log.log(Level.FINE, "Unable to send NULL email message. No message to send."); } }
From source file:edu.umass.cs.msocket.proxy.GnsTimerKeepalive.java
/** * Creates a new <code>GnsTimerKeepalive</code> object * //from w ww.java 2 s. co m * @param gnsCredentials * @param myGuid * @param publishFrequency * @throws Exception if a GNS error occurs */ public GnsTimerKeepalive(GnsCredentials gnsCredentials, GuidEntry myGuid, int publishFrequency) throws Exception { this.gnsCredentials = gnsCredentials; this.guid = myGuid; this.publishFrequency = publishFrequency; logger.fine("Publishing start time"); final long now = System.currentTimeMillis(); UniversalGnsClient gnsClient = gnsCredentials.getGnsClient(); gnsClient.fieldReplaceOrCreate(myGuid.getGuid(), GnsConstants.START_TIME, new JSONArray().put(now), myGuid); gnsClient.aclAdd(AccessType.READ_WHITELIST, myGuid, GnsConstants.START_TIME, null); gnsClient.fieldReplaceOrCreate(myGuid.getGuid(), GnsConstants.TIME_REFRESH_INTERVAL, new JSONArray().put(publishFrequency), myGuid); gnsClient.aclAdd(AccessType.READ_WHITELIST, myGuid, GnsConstants.TIME_REFRESH_INTERVAL, null); gnsClient.fieldReplaceOrCreate(guid.getGuid(), GnsConstants.CURRENT_TIME, new JSONArray().put(now), myGuid); gnsClient.aclAdd(AccessType.READ_WHITELIST, myGuid, GnsConstants.CURRENT_TIME, null); logger.setLevel(Level.FINE); }
From source file:com.joyfulmongo.db.javadriver.JFDBQuery.java
public List<JFDBObject> find() { long start = System.currentTimeMillis(); DBCollection collection = getDBCollection(collectionName); List<JFDBObject> result = new ArrayList<JFDBObject>(0); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE,/*from w ww . j av a2 s . com*/ "Find collection=" + collection + "\n" + " constraints " + constraints + "\n" + " projections=" + projections + "\n" + " limit=" + limit + "\n" + " skip=" + skip + "\n" + " sortby=" + sortBy + "\n"); } DBCursor cursor = collection.find(constraints, projections).limit(limit).skip(skip).sort(sortBy); while (cursor.hasNext()) { DBObject obj = cursor.next(); result.add(new JFDBObject(collectionName, obj)); } MonitorManager.getInstance().logQuery(collectionName, JFDBUtil.toJSONObject(constraints), JFDBUtil.toJSONObject(sortBy), System.currentTimeMillis() - start); return result; }
From source file:net.chrissearle.flickrvote.service.DaoTagSearchService.java
private Photographer retrievePhotographer(String flickrId) { if (logger.isLoggable(Level.FINE)) { logger.fine("Searching for photographer: " + flickrId); }// w w w . j a va 2 s. co m Photographer photographer = photographyDao.findById(flickrId); if (photographer != null) { if (logger.isLoggable(Level.FINE)) { logger.fine("Found: " + photographer); } } else { if (logger.isLoggable(Level.FINE)) { logger.fine("Retrieving: " + flickrId); } FlickrPhotographer flickrPhotographer = flickrUserDao.getUser(flickrId); photographer = new Photographer(flickrPhotographer.getUsername(), flickrPhotographer.getRealname(), flickrPhotographer.getFlickrId(), flickrPhotographer.getIconUrl()); photographyDao.persist(photographer); // TODO - check to see if the persisted object matches a fresh retrieval photographer = photographyDao.findById(flickrId); } return photographer; }
From source file:edu.harvard.iq.dataverse.HandlenetServiceBean.java
public void reRegisterHandle(Dataset dataset) { logger.log(Level.FINE, "reRegisterHandle"); if (!HANDLE_PROTOCOL_TAG.equals(dataset.getProtocol())) { logger.warning(//from w w w.j a v a 2 s . co m "reRegisterHandle called on a dataset with the non-handle global id: " + dataset.getId()); } String handle = getDatasetHandle(dataset); boolean handleRegistered = isHandleRegistered(handle); if (handleRegistered) { // Rebuild/Modify an existing handle logger.info("Re-registering an existing handle id " + handle); String authHandle = getHandleAuthority(dataset); HandleResolver resolver = new HandleResolver(); String datasetUrl = getRegistrationUrl(dataset); logger.info("New registration URL: " + datasetUrl); PublicKeyAuthenticationInfo auth = getAuthInfo(dataset.getAuthority()); try { AdminRecord admin = new AdminRecord(authHandle.getBytes("UTF8"), 300, true, true, true, true, true, true, true, true, true, true, true, true); int timestamp = (int) (System.currentTimeMillis() / 1000); HandleValue[] val = { new HandleValue(100, "HS_ADMIN".getBytes("UTF8"), Encoder.encodeAdminRecord(admin), HandleValue.TTL_TYPE_RELATIVE, 86400, timestamp, null, true, true, true, false), new HandleValue(1, "URL".getBytes("UTF8"), datasetUrl.getBytes(), HandleValue.TTL_TYPE_RELATIVE, 86400, timestamp, null, true, true, true, false) }; ModifyValueRequest req = new ModifyValueRequest(handle.getBytes("UTF8"), val, auth); resolver.traceMessages = true; AbstractResponse response = resolver.processRequest(req); if (response.responseCode == AbstractMessage.RC_SUCCESS) { logger.info("\nGot Response: \n" + response); } else { logger.info("\nGot Error: \n" + response); } } catch (Throwable t) { logger.fine("\nError: " + t); } } else { // Create a new handle from scratch: logger.info("Handle " + handle + " not registered. Registering (creating) from scratch."); registerNewHandle(dataset); } }
From source file:net.daboross.bukkitdev.skywars.gist.GistReport.java
public static String shortenURL(Logger logger, String url) { URL requestUrl;// w w w. j a v a 2 s. c om try { requestUrl = new URL("http://is.gd/create.php?format=simple&url=" + URLEncoder.encode(url, "UTF-8")); } catch (MalformedURLException | UnsupportedEncodingException ex) { logger.log(Level.FINE, "Non severe error encoding is.gd URL", ex); return url; } URLConnection connection; try { connection = requestUrl.openConnection(); return readConnection(connection); } catch (IOException ex) { logger.log(Level.FINE, "Non severe error getting is.gd response", ex); return url; } }
From source file:net.chrissearle.flickrvote.web.admin.ScoreAction.java
@Override public String execute() throws Exception { if (logger.isLoggable(Level.FINE)) { for (int i = 0; i < id.size(); i++) { logger.fine("ID: " + id.get(i) + " SCORE: " + score.get(i)); }// ww w . j a v a 2 s . c o m } for (int i = 0; i < id.size(); i++) { photographyService.setScore(id.get(i), score.get(i)); } return SUCCESS; }
From source file:org.globus.security.stores.AbstractResourceSecurityWrapper.java
public File getFile() { try {/*from w w w. j av a 2s.co m*/ return resource.getFile(); } catch (IOException e) { logger.log(Level.FINE, "Resource is not a file", e); return null; } }