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:com.messagemedia.restapi.client.v1.internal.http.interceptors.HmacMmv2Interceptor.java
@Override public void process(HttpRequest request, HttpContext context) throws HttpException, IOException { StringBuilder toSign = new StringBuilder(); toSign.append(HttpHeaders.DATE);/*from w w w. j a v a 2 s. c o m*/ toSign.append(": "); toSign.append(request.getFirstHeader(HttpHeaders.DATE).getValue()); toSign.append("\n"); toSign.append(request.getRequestLine().toString()); boolean hasContent = request.containsHeader(HttpHeaders.CONTENT_MD5); final String headers; if (hasContent) { toSign.append("\n"); toSign.append(HttpHeaders.CONTENT_MD5); toSign.append(": "); toSign.append(request.getFirstHeader(HttpHeaders.CONTENT_MD5)); headers = HEADERS_WITH_CONTENT; } else { headers = HEADERS_WITHOUT_CONTENT; } String stringToSign = toSign.toString(); LOGGER.log(Level.FINEST, "String to sign: " + stringToSign); String hmac = HMACUtils.sha1(userSecret, stringToSign); String headerValue = String.format(AUTH_HEADER_TEMPLATE, userKey, headers, hmac); request.setHeader(HttpHeaders.AUTHORIZATION, headerValue); LOGGER.log(Level.FINE, "Header value: " + headerValue); }
From source file:org.hydroponics.dao.JDBCHydroponicsDaoImpl.java
private void executeScript(InputStream inputStream) { try {/*from w w w. j a v a 2 s . c o m*/ BufferedReader d = new BufferedReader(new InputStreamReader(inputStream)); String thisLine, sqlQuery = ""; while ((thisLine = d.readLine()) != null) { //Skip comments and empty lines if (thisLine.length() > 0 && thisLine.charAt(0) == '-' || thisLine.length() == 0) continue; sqlQuery = sqlQuery + " " + thisLine; if (sqlQuery.charAt(sqlQuery.length() - 1) == ';') { logger.log(Level.FINE, sqlQuery); sqlQuery = sqlQuery.replace(';', ' '); //Remove the ; since jdbc complains jdbcTemplate.execute(sqlQuery); sqlQuery = ""; } } } catch (Exception ex) { logger.log(Level.SEVERE, "Error Creating the SQL Database : " + ex.getMessage(), ex); } }
From source file:com.bbva.arq.devops.ae.mirrorgate.jenkins.plugin.listener.MirrorGateListenerHelper.java
public void sendBuildFromJob(Job job, TaskListener listener) { if (job != null && job.getLastBuild() != null) { BuildStatus status = job.isBuildable() ? (job.getLastBuild().getResult() != null ? BuildStatus.fromString(job.getLastBuild().getResult().toString()) : BuildStatus.InProgress) : BuildStatus.Deleted; BuildBuilder builder = new BuildBuilder(job.getLastBuild(), status); MirrorGateResponse response = getMirrorGateService().publishBuildData(builder.getBuildData()); String msg;//from w w w. j a v a 2 s .co m Level level; if (response.getResponseCode() == HttpStatus.SC_CREATED) { msg = "MirrorGate: Published Build Complete Data. " + response.toString(); level = Level.FINE; } else { msg = "MirrorGate: Build Status could not been sent to MirrorGate. Please contact with " + "MirrorGate Team for further information (mirrorgate.group@bbva.com)."; level = Level.WARNING; } if (listener != null && level == Level.FINE) { listener.getLogger().println("Follow this project's builds progress at: " + createMirrorgateLink(builder.getBuildData().getProjectName())); listener.getLogger().println(msg); } LOG.log(level, msg); sendBuildExtraData(builder, listener); } }
From source file:org.camunda.bpm.elasticsearch.index.ElasticSearchDefaultIndexStrategy.java
public void executeRequest(HistoryEvent historyEvent) { try {/*from w w w . j ava2 s . co m*/ if (filterEvents(historyEvent)) { return; } UpdateRequestBuilder updateRequestBuilder = prepareUpdateRequest(historyEvent); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine(ElasticSearchHelper.convertRequestToJson(updateRequestBuilder.request())); } UpdateResponse updateResponse; if (WAIT_FOR_RESPONSE > 0) { updateResponse = updateRequestBuilder.get(TimeValue.timeValueSeconds(WAIT_FOR_RESPONSE)); } else { updateResponse = updateRequestBuilder.get(); } if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("[" + updateResponse.getIndex() + "][" + updateResponse.getType() + "][update] process instance with id '" + updateResponse.getId() + "'"); LOGGER.log(Level.FINE, "Source: " + updateResponse.getGetResult().sourceAsString()); } } catch (IOException e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); } }
From source file:com.joyfulmongo.db.javadriver.MongoQuery.java
public List<MongoObject> find() { long start = System.currentTimeMillis(); DBCollection collection = getDBCollection(collectionName); List<MongoObject> result = new ArrayList<MongoObject>(limit); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE,/*from ww w . j a v a2 s . c o m*/ "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).sort(sortBy).skip(skip).limit(limit + skip); while (cursor.hasNext()) { result.add(new MongoObject(collectionName, cursor.next())); } MonitorManager.getInstance().logQuery(collectionName, MongoDBUtil.toJSONObject(constraints), MongoDBUtil.toJSONObject(sortBy), System.currentTimeMillis() - start); return result; }
From source file:net.chrissearle.flickrvote.web.CurrentChallengeAction.java
public void prepare() throws Exception { final Photographer photographer = (Photographer) session .get(FlickrVoteWebConstants.FLICKR_USER_SESSION_KEY); ChallengeSummary challengeSummary = null; // Get a list of all open challenges final Set<ChallengeSummary> challenges = challengeService.getChallengesByType(ChallengeType.OPEN); // Currently the web layer is designed for one current challengeSummary only if (0 < challenges.size()) { challengeSummary = challenges.iterator().next(); }/*from w w w . ja v a 2s.co m*/ if (log.isLoggable(Level.FINE)) { log.fine("Current challengeSummary " + challengeSummary); } if (null != challengeSummary) { this.challenge = new DisplayChallengeSummary(challengeSummary); final ImageItems imageItems = tagSearchService.searchByTagAndDate(challengeSummary.getTag(), challengeSummary.getStartDate()); final ChallengeItem challengeItem = photographyService.getChallengeImages(challengeSummary.getTag()); final List<ImageItem> imagesUniquePhotographer = imageItems .getImagesUniquePhotographer(challengeItem.getImages()); for (ImageItem image : imagesUniquePhotographer) { final DisplayImage displayImage = new DisplayImage(image); images.add(displayImage); if (null != photographer && displayImage.getPhotographerId().equals(photographer.getPhotographerId())) { this.currentPhotographerImage = displayImage; } } Collections.sort(this.images, new Comparator<Image>() { public int compare(Image o1, Image o2) { return o2.getPostedDate().compareTo(o1.getPostedDate()); } }); } }
From source file:net.sf.jasperreports.jsf.resource.DefaultResourceResolver.java
private Resource resolveRelative(FacesContext context, UIComponent component, String name) { if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "JRJSF_0039", name); }// w w w.j a v a2 s . c o m Resource resource = null; JRFacesContext jrContext = JRFacesContext.getInstance(context); ExternalContextHelper helper = jrContext.getExternalContextHelper(context); String rootPath = null; if ((component != null) && (component instanceof UIReport)) { // If caller component is a report-based component then try to // resolve the resource relative to the report resource (if given). Object value = ((UIReport) component).getValue(); if (value != null && (value instanceof String)) { String valueStr = (String) value; if (!valueStr.equals(name)) { // If the resource we are trying to resolve is the one // established in the report itself then resolve it // using the current viewRoot //cristhiank: If its relative to a classpath resource final ClassLoader loader = Util.getClassLoader(this); if (valueStr.startsWith(ClasspathResource.PREFIX)) { String completeName = valueStr.substring(0, valueStr.lastIndexOf("/") + 1) + name; resource = new ClasspathResource(completeName, loader); } else { rootPath = helper.getResourceRealPath(context.getExternalContext(), "/" + getPath((String) value)); } } } } if (rootPath == null) { // If caller component is not a report-based component or // there is not any component at all, resolve the resource // name relative to the current view. String viewId = context.getViewRoot().getViewId(); rootPath = helper.getResourceRealPath(context.getExternalContext(), "/" + getPath(viewId)); } if (rootPath != null) { String resourceFileName = rootPath + File.separator + name; File resourceFile = new File(normalize(resourceFileName)); if (resourceFile.exists()) { resource = new FileResource(resourceFile); } } return resource; }
From source file:net.kungfoo.grizzly.proxy.impl.Activator.java
private static void setup() throws IOReactorException { setupClient();/*ww w.ja v a2s . co m*/ selectorThread = new SelectorThread(); selectorThread.setPort(8282); ProxyAdapter httpProxy = new ProxyAdapter(connectingIOReactor); DefaultAsyncHandler handler = new DefaultAsyncHandler(); handler.addAsyncFilter(new AsyncFilter() { @Override public boolean doFilter(AsyncExecutor asyncExecutor) { final AsyncTask asyncTask = asyncExecutor.getAsyncTask(); final AsyncHandler asyncHandler = asyncExecutor.getAsyncHandler(); DefaultProcessorTask task = (DefaultProcessorTask) asyncExecutor.getProcessorTask(); task.getRequest().setAttribute(ProxyAdapter.CALLBACK_KEY, new Runnable() { @Override public void run() { asyncHandler.handle(asyncTask); } }); task.invokeAdapter(); return false; } }); selectorThread.setAsyncHandler(handler); selectorThread.setAdapter(httpProxy); selectorThread.setEnableAsyncExecution(true); selectorThread.setDisplayConfiguration(true); ProxyAdapter.logger.setLevel(Level.FINEST); ConsoleHandler consoleHandler = new ConsoleHandler(); ProxyAdapter.logger.addHandler(consoleHandler); ProxyAdapter.logger.log(Level.FINE, "Setup done."); }
From source file:magma.agent.behavior.complex.GoalieBehavior.java
@Override public void perform(float intensity) { if (currentBehavior == null || currentBehavior.isFinished()) { ballPosition = worldModel.getBall().getPosition(); goalie = worldModel.getThisPlayer(); leftSide = goalie.getSide() == IMagmaConstants.LEFT_SIDE; rightSide = goalie.getSide() == IMagmaConstants.RIGHT_SIDE; boolean none = false; float newY = calculateNewGoaliePos(ballPosition.getX(), ballPosition.getY()); if (newY == 0.7f || newY == -0.7f) none = true;//w w w .j a v a 2 s .co m zAngle = 0.0; if (rightSide)// inverting y values for right side. { newY = -newY; zAngle = 180.0; } Vector3D newPosition = new Vector3D(goalie.getPosition().getX(), newY, 0.0); // log logger.log(Level.FINE, "Goalie behavior. new position - x,y,z : ({0}, {1}, {2})", new Object[] { newPosition.getX(), newPosition.getY(), newPosition.getZ() }); // ball kick-able and isSafeToKick(when kicked will not be self goal) if (isSafeToKick()) { // kick with right or left foot currentBehavior = behaviors.get(IBehavior.SHOOT_TO_GOAL); } else if (!checkAngle(zAngle)) { // player is facing somewhere other // than // opponent's goal turnPlayer(zAngle); } else if (Geometry.isInsidePolygon(ballPosition, getBallToBeKickedRectangle())) { currentBehavior = behaviors.get(IBehavior.GET_IN_SCORE_POSITION); } else if (!none && goalie.getPosition().getY() - newPosition.getY() < -0.2) { // move left currentBehavior = behaviors.get(STEP_LEFT); } else if (!none && goalie.getPosition().getY() - newPosition.getY() > 0.2) { // move right currentBehavior = behaviors.get(STEP_RIGHT); } // else // currentBehavior = behaviors.get(NONE); // // // distance to newPosition is greater than distance to ball // // TODO also check if opponent is closer than you // else if (FuzzyCompare.gt((float) worldModel.getThisPlayer() // .getDistanceTo(newPosition), (float) worldModel.getThisPlayer() // .getDistanceTo(worldModel.getBall()), 0.3f)) { // // run to ball // // TODO change run_to_ball to something else // System.out // .println("----------------------------------------********----------run to ball"); // currentBehavior = behaviors.get(IBehavior.RUN_TO_BALL); // } // // distance to position smaller // else if (FuzzyCompare.lt((float) worldModel.getThisPlayer() // .getDistanceTo(newPosition), (float) worldModel.getThisPlayer() // .getDistanceTo(worldModel.getBall()), 0.3f)) { // // run to position // System.out // .println("----------------------------------------********----------run to p"); // /** ====> */ // System.out.println("my x=" + thisPlayer.getPosition().getX() // + " y=" + thisPlayer.getPosition().getY() + " z=" // + thisPlayer.getPosition().getZ()); // // System.out.println("x=" + newPosition.getX() + " y=" // + newPosition.getY() + " z=" + newPosition.getZ()); // // System.out.println("new ops=" // + worldModel.getThisPlayer().getDistanceTo(newPosition) // + " ball=" // + worldModel.getThisPlayer().getDistanceTo( // worldModel.getBall())); // currentBehavior = behaviors.get(IBehavior.RUN_TO_POSITION); // ((RunToPosition) currentBehavior).setPosition(newPosition, // calculateRot()); // // } else { currentBehavior = behaviors.get(IBehavior.NONE); } currentBehavior.init(); } currentBehavior.perform(intensity); }
From source file:de.theit.hudson.crowd.CrowdMailAddressResolverImpl.java
/** * {@inheritDoc}/*from www . jav a 2 s . co m*/ * * @see hudson.tasks.MailAddressResolver#findMailAddressFor(hudson.model.User) */ @Override public String findMailAddressFor(User u) { String mail = null; SecurityRealm realm = Hudson.getInstance().getSecurityRealm(); if (realm instanceof CrowdSecurityRealm) { try { // Workaround: // The user object given as parameter contains the user's // display name. Looking up a user in Crowd by the full display // name doesn't work; we have to use the user's Id instead which // is actually appended at the end of the display name in // brackets String userId = u.getId(); int pos = userId.lastIndexOf('('); if (pos > 0) { int pos2 = userId.indexOf(')', pos + 1); if (pos2 > pos) { userId = userId.substring(pos + 1, pos2); } } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Looking up mail address for user: " + userId); } CrowdUser details = (CrowdUser) realm.getSecurityComponents().userDetails .loadUserByUsername(userId); mail = details.getEmailAddress(); } catch (UsernameNotFoundException ex) { if (LOG.isLoggable(Level.INFO)) { LOG.info("Failed to look up email address in Crowd"); } } catch (DataAccessException ex) { LOG.log(Level.SEVERE, "Access exception trying to look up email address in Crowd", ex); } } return mail; }