List of usage examples for java.util.logging Level FINER
Level FINER
To view the source code for java.util.logging Level FINER.
Click Source Link
From source file:org.b3log.latke.repository.gae.GAERepository.java
@Override public GAETransaction beginTransaction() { GAETransaction ret = TX.get();/*from w w w .j a va2 s .c o m*/ if (null != ret) { LOGGER.log(Level.FINER, "There is a transaction[isActive={0}] in current thread", ret.isActive()); if (ret.isActive()) { return TX.get(); // Using 'the current transaction' } } final com.google.appengine.api.datastore.Transaction gaeTx = datastoreService.beginTransaction(); ret = new GAETransaction(gaeTx); TX.set(ret); return ret; }
From source file:org.schemaspy.Config.java
/** * Set the level of logging to perform.<p/> * The levels in descending order are:/* www . j av a2 s.c om*/ * <ul> * <li><code>severe</code> (highest - least detail) * <li><code>warning</code> (default) * <li><code>info</code> * <li><code>config</code> * <li><code>fine</code> * <li><code>finer</code> * <li><code>finest</code> (lowest - most detail) * </ul> * * @param logLevel */ public void setLogLevel(String logLevel) { if (logLevel == null) { this.logLevel = Level.WARNING; return; } Map<String, Level> levels = new LinkedHashMap<>(); levels.put("severe", Level.SEVERE); levels.put("warning", Level.WARNING); levels.put("info", Level.INFO); levels.put("config", Level.CONFIG); levels.put("fine", Level.FINE); levels.put("finer", Level.FINER); levels.put("finest", Level.FINEST); this.logLevel = levels.get(logLevel.toLowerCase()); if (this.logLevel == null) { throw new InvalidConfigurationException( "Invalid logLevel: '" + logLevel + "'. Must be one of: " + levels.keySet()); } }
From source file:com.ibm.team.build.internal.hjplugin.util.HttpUtils.java
/** * Print out the HTTP Response body - for debugging purposes *//*from ww w. j av a 2 s. co m*/ @SuppressWarnings("unused") private static void printResponseBody(CloseableHttpResponse response) { if (LOGGER.isLoggable(Level.FINER)) { HttpEntity entity = response.getEntity(); if (entity == null) return; StringBuffer logMessage = new StringBuffer("Response Body:"); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(entity.getContent())); String line = reader.readLine(); while (line != null) { logMessage.append(NEW_LINE).append(line); line = reader.readLine(); } LOGGER.finer(logMessage.toString()); } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { // ignore } } } } }
From source file:com.ibm.jaggr.core.impl.transport.AbstractHttpTransport.java
/** * Returns an instance of a FeatureMapJSResourceFactory. * * @param resourceUri// ww w. j a v a 2s. c om * the resource {@link URI} * @return a new factory object */ protected FeatureListResourceFactory newFeatureListResourceFactory(URI resourceUri) { final String methodName = "newFeatureMapJSResourceFactory"; //$NON-NLS-1$ boolean traceLogging = log.isLoggable(Level.FINER); if (traceLogging) { log.entering(AbstractHttpTransport.class.getName(), methodName, new Object[] { resourceUri }); } FeatureListResourceFactory factory = new FeatureListResourceFactory(resourceUri); if (traceLogging) { log.exiting(AbstractHttpTransport.class.getName(), methodName); } return factory; }
From source file:foodsimulationmodel.pathmapping.Route.java
/** * Finds the shortest route between multiple origin and destination junctions. Will return the shortest path and * also, via two parameters, can return the origin and destination junctions which make up the shortest route. * //from ww w .j av a2 s . c om * @param currentJunctions * An array of origin junctions * @param destJunctions * An array of destination junctions * @param routeEndpoints * An array of size 2 which can be used to store the origin (index 0) and destination (index 1) Junctions * which form the endpoints of the shortest route. * @return the shortest route between the origin and destination junctions * @throws Exception */ private List<RepastEdge<Junction>> getShortestRoute(List<Junction> currentJunctions, List<Junction> destJunctions, Junction[] routeEndpoints) throws Exception { double time = System.nanoTime(); synchronized (GlobalVars.TRANSPORT_PARAMS.currentBurglarLock) { // This must be set so that NetworkEdge.getWeight() can adjust the weight depending on how this // particular agent is getting around the city GlobalVars.TRANSPORT_PARAMS.currentAgent = this.agent; double shortestPathLength = Double.MAX_VALUE; double pathLength = 0; ShortestPath<Junction> p; List<RepastEdge<Junction>> shortestPath = null; for (Junction o : currentJunctions) { for (Junction d : destJunctions) { if (o == null || d == null) { LOGGER.log(Level.WARNING, "Route.getShortestRoute() error: either the destination or origin " + "junction is null. This can be caused by disconnected roads. It's probably OK" + "to ignore this as a route should still be created anyway."); } else { p = new ShortestPath<Junction>(ContextManager.roadNetwork); pathLength = p.getPathLength(o, d); if (pathLength < shortestPathLength) { shortestPathLength = pathLength; shortestPath = p.getPath(o, d); // ShortestPath<Junction> p2 = new ShortestPath<Junction>(ContextManager.roadNetwork); // shortestPath = p2.getPath(o, d); // p2.finalize(); // p2 = null; // shortestPath = p1.getPath(o, d); // p1.finalize(); p1 = null; routeEndpoints[0] = o; routeEndpoints[1] = d; } // TODO See if the shortestpath bug has been fixed, would make this unnecessary p.finalize(); p = null; } // if junc null } // for dest junctions } // for origin junctions if (shortestPath == null) { String debugString = "Route.getShortestRoute() could not find a route. Looking for the shortest route between :\n"; for (Junction j : currentJunctions) debugString += "\t" + j.toString() + ", roads: " + j.getRoads().toString() + "\n"; for (Junction j : destJunctions) debugString += "\t" + j.toString() + ", roads: " + j.getRoads().toString() + "\n"; throw new RoutingException(debugString); } LOGGER.log(Level.FINER, "Route.getShortestRoute (" + (0.000001 * (System.nanoTime() - time)) + "ms) found shortest path " + "(length: " + shortestPathLength + ") from " + routeEndpoints[0].toString() + " to " + routeEndpoints[1].toString()); return shortestPath; } // synchronized }
From source file:org.cloudifysource.rest.controllers.ServiceController.java
/** * Creates and returns a map containing all of the deployed service names installed under a specific application * context.//ww w . j a v a 2 s . c o m * * @param applicationName * . * @return a list of the deployed services in the service grid that were deployed as a part of a specific * application. * @throws RestErrorException * When application is not found. */ @JsonResponseExample(status = "sucess", responseBody = "[\"service1\",\"service2\"]") @PossibleResponseStatuses(responseStatuses = { @PossibleResponseStatus(code = HTTP_OK, description = "success"), @PossibleResponseStatus(code = HTTP_INTERNAL_SERVER_ERROR, description = "failed_to_locate_app") }) @RequestMapping(value = "/applications/{applicationName}/services/description", method = RequestMethod.GET) @PreAuthorize("isFullyAuthenticated()") @PostFilter("hasPermission(filterObject, 'view')") @ResponseBody public Map<String, Object> getServicesDescriptionList(@PathVariable final String applicationName) throws RestErrorException { if (logger.isLoggable(Level.FINER)) { logger.finer("received request to list applications"); } final Application app = admin.getApplications().waitFor(applicationName, 5, TimeUnit.SECONDS); if (app == null) { throw new RestErrorException(FAILED_TO_LOCATE_APP, applicationName); } final ApplicationDescriptionFactory appDescriptionFactory = new ApplicationDescriptionFactory(admin); final ApplicationDescription applicationDescription = appDescriptionFactory.getApplicationDescription(app); final List<ApplicationDescription> applicationDescriptionList = new ArrayList<ApplicationDescription>(); applicationDescriptionList.add(applicationDescription); return successStatus(applicationDescriptionList); }
From source file:com.ibm.team.build.internal.hjplugin.util.HttpUtils.java
@SuppressWarnings("unused") private static void printCookies(HttpClientContext httpContext) { if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("Cookies:"); //$NON-NLS-1$ CookieStore cookieStore = (CookieStore) httpContext.getAttribute(HttpClientContext.COOKIE_STORE); List<Cookie> cookies = cookieStore.getCookies(); if (cookies.isEmpty()) { System.out.println("\tNone"); //$NON-NLS-1$ } else {//from w w w . j a v a2 s .c o m for (int i = 0; i < cookies.size(); i++) { LOGGER.finer("\t- " + cookies.get(i).toString()); //$NON-NLS-1$ } } } }
From source file:com.ibm.jaggr.core.impl.AbstractAggregatorImpl.java
/** * Adds the specified extension to the list of registered extensions. * * @param ext//from w w w . j ava2 s .com * The extension to add * @param before * Reference to an existing extension that the * new extension should be placed before in the list. If null, * then the new extension is added to the end of the list */ protected void registerExtension(IAggregatorExtension ext, IAggregatorExtension before) { final String sourceMethod = "registerExtension"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(AbstractAggregatorImpl.class.getName(), sourceMethod, new Object[] { ext, before }); } // validate type String id = ext.getExtensionPointId(); if (IHttpTransportExtensionPoint.ID.equals(id)) { if (before != null) { throw new IllegalArgumentException(before.getExtensionPointId()); } httpTransportExtension = ext; } else { List<IAggregatorExtension> list; if (IResourceFactoryExtensionPoint.ID.equals(id)) { list = resourceFactoryExtensions; } else if (IModuleBuilderExtensionPoint.ID.equals(id)) { list = moduleBuilderExtensions; } else if (IServiceProviderExtensionPoint.ID.equals(id)) { list = serviceProviderExtensions; } else { throw new IllegalArgumentException(id); } if (before == null) { list.add(ext); } else { // find the extension to insert the item in front of boolean inserted = false; for (int i = 0; i < list.size(); i++) { if (list.get(i) == before) { resourceFactoryExtensions.add(i, ext); inserted = true; break; } } if (!inserted) { throw new IllegalArgumentException(); } } // If this is a service provider extension the register the specified service if // one is indicated. if (IServiceProviderExtensionPoint.ID.equals(id)) { String interfaceName = ext.getAttribute(IServiceProviderExtensionPoint.SERVICE_ATTRIBUTE); if (interfaceName != null) { try { Dictionary<String, String> props = new Hashtable<String, String>(); // Copy init-params from extension to service dictionary Set<String> attributeNames = new HashSet<String>(ext.getAttributeNames()); attributeNames.removeAll(Arrays.asList( new String[] { "class", IServiceProviderExtensionPoint.SERVICE_ATTRIBUTE })); //$NON-NLS-1$ for (String propName : attributeNames) { props.put(propName, ext.getAttribute(propName)); } // Set name property to aggregator name props.put("name", getName()); //$NON-NLS-1$ registrations.add( getPlatformServices().registerService(interfaceName, ext.getInstance(), props)); } catch (Exception e) { if (log.isLoggable(Level.WARNING)) { log.log(Level.WARNING, e.getMessage(), e); } } } } } if (isTraceLogging) { log.exiting(AbstractAggregatorImpl.class.getName(), sourceMethod); } }
From source file:core.module.codec.EncodeDecodeOtaMessage.java
private static InboundMessage decode(Date messageSubmitDate, InputStream is, boolean is19BitDateFormat) throws IOException { int b = is.read(); switch (b) {// w ww . j a v a 2 s . c om case RETRIEVE_COMMAND_RESPONSE: case SEND_READING_NORMAL_RESPONSE: case SEND_READING_ALARM_RESPONSE: if (is19BitDateFormat) { return decodeRetrieveCommand19Bit(messageSubmitDate, b, is); } else { return decodeRetrieveCommand(messageSubmitDate, b, is); } case SET_PARAMETER_ACK: return decodeSetParamterAck(is); case GET_PARAMETER_ACK: return decodeGetParamterAck(is, 0, is19BitDateFormat); case EVENT_BATTERY_LOW: return new EventBatteryLow(messageSubmitDate); case EVENT_BATTERY_FULL: return new EventBatteryFull(messageSubmitDate); case EVENT_MAX_SN_EXCEEDED: return new EventMaxSerialNumberExceeded(messageSubmitDate); case EVENT_CORRUPTED_GM_CONNECTED: return new EventCorruptedGlucoseMeterConnected(messageSubmitDate); case EVENT_RADIO_RESET: return new EventRadioReset(messageSubmitDate); case ERASE_COMMAND_ACK: return decodeEraseCommandAck(is); case SET_PARAMETER_FAILED: return decodeSetParameterFailed(is); case GET_PARAMETER_FAILED: return decodeGetParameterFailed(is); case ERASE_COMMAND_FAILED: return decodeEraseCommandFailed(is); case RETRIEVE_COMMAND_RESPONSE_FAILED: return decodeRetrieveCommandResponseFailed(is); case GET_DIAGNOSTIC_COMMAND: // no-op this can be stored in db later if actually used for ops support // for now, look at the hex dump of the message in the log to // see the diagnostic values. return null; case INVALID_MSG_CONTENT: logger.log(Level.FINER, "Invalid content message 0x{0}", EncodeDecodeOtaMessage.toHexString(b)); return new InvalidContentMessage(); default: throw new IllegalArgumentException("Command not understood 0x" + EncodeDecodeOtaMessage.toHexString(b)); } }
From source file:org.cloudifysource.rest.controllers.ServiceController.java
/** * * Creates a list of all service instances in the specified application. * * @param applicationName//w w w . ja v a 2 s . co m * The application name. * @param serviceName * The service name. * @return a Map containing all service instances of the specified application * @throws RestErrorException * When service is not found. */ @JsonResponseExample(status = "success", responseBody = "{\"1\":\"127.0.0.1\"}", comments = "In the example" + " instance id is 1 and the HOST is 127.0.0.1") @PossibleResponseStatuses(responseStatuses = { @PossibleResponseStatus(code = HTTP_OK, description = "success"), @PossibleResponseStatus(code = HTTP_INTERNAL_SERVER_ERROR, description = "failed_to_locate_service") }) @RequestMapping(value = "applications/{applicationName}/services/{serviceName}/instances", method = RequestMethod.GET) @PreAuthorize("isFullyAuthenticated()") @ResponseBody public Map<String, Object> getServiceInstanceList(@PathVariable final String applicationName, @PathVariable final String serviceName) throws RestErrorException { final String absolutePuName = ServiceUtils.getAbsolutePUName(applicationName, serviceName); if (logger.isLoggable(Level.FINER)) { logger.finer("received request to list instances for service " + absolutePuName + " of application " + applicationName); } // todo: application awareness final ProcessingUnit pu = admin.getProcessingUnits().waitFor(absolutePuName, PU_DISCOVERY_TIMEOUT_SEC, TimeUnit.SECONDS); if (pu == null) { logger.severe("Could not find service " + absolutePuName); return unavailableServiceError(absolutePuName); } if (permissionEvaluator != null) { final String puAuthGroups = pu.getBeanLevelProperties().getContextProperties() .getProperty(CloudifyConstants.CONTEXT_PROPERTY_AUTH_GROUPS); final Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); final CloudifyAuthorizationDetails authDetails = new CloudifyAuthorizationDetails(authentication); permissionEvaluator.verifyPermission(authDetails, puAuthGroups, "view"); } final Map<Integer, String> instanceMap = new HashMap<Integer, String>(); final ProcessingUnitInstance[] instances = pu.getInstances(); for (final ProcessingUnitInstance instance : instances) { final String publicIp = instance.getVirtualMachine().getDetails().getEnvironmentVariables() .get(CloudifyConstants.GIGASPACES_AGENT_ENV_PUBLIC_IP); final String host = instance.getVirtualMachine().getMachine().getHostName(); String description = host; if (publicIp != null) { description += "/" + publicIp; } instanceMap.put(instance.getInstanceId(), description); } return successStatus(instanceMap); }