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:com.jwebmp.core.htmlbuilder.javascript.JavaScriptPart.java
/** * Returns the object presented as a JSON strong * * @param o//from ww w .jav a 2 s .c o m * An object to represent * * @return the string */ public String objectAsString(Object o) { try { ObjectWriter writer = GuiceContext.get(JSONObjectWriter); return writer.writeValueAsString(o).replace("\r\n", "\n"); } catch (JsonProcessingException ex) { JavaScriptPart.log.log(Level.FINER, "Unable to Serialize as JSON Json Processing Exception", ex); return ""; } catch (Exception ex) { JavaScriptPart.log.log(Level.SEVERE, "Unable to Serialize as JSON", ex); return ""; } }
From source file:ch.cyberduck.core.gdocs.GDSession.java
@Override protected void fireConnectionWillOpenEvent() throws ResolveCanceledException, UnknownHostException { http.setLevel(Level.FINER); http.addHandler(appender);/* w ww .j a v a2 s. co m*/ super.fireConnectionWillOpenEvent(); }
From source file:org.apache.cxf.jca.outbound.ManagedConnectionFactoryImpl.java
public ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo connReqInfo) throws ResourceException { if (LOG.isLoggable(Level.FINER)) { LOG.finer("Create managed connection subject=" + subject + "connReqInfo=" + connReqInfo); }/*from ww w .ja v a 2s . c om*/ return new ManagedConnectionImpl(this, connReqInfo, subject); }
From source file:ComputeNode.java
public ComputeNode(String servername, Double _underLoadThreshold, Double _overLoadThreshold, Double _failProbability, Double _loadConstant, Pair<Double, Double> _loadGaussian, String configFile) throws Exception { server = (ServerInterface) Naming.lookup("//" + servername + "/Server"); id = server.registerNode();//w ww .j ava 2 s. co m lg = new Logger("Compute Node:" + id); lg.log(Level.INFO, "ComputeNode " + id + " started."); // If a config file was specified if (configFile == null) { configFile = defaultconf; } try { // TODO: Only load if we need to. Properties properties = new Properties(); properties.load(new FileInputStream(configFile)); if (_overLoadThreshold == null) _overLoadThreshold = new Double(properties.getProperty("computenode.overload_threshhold")); overLoadThreshold = _overLoadThreshold; if (_underLoadThreshold == null) _underLoadThreshold = new Double(properties.getProperty("computenode.underload_threshhold")); underLoadThreshold = _underLoadThreshold; if (_failProbability == null) _failProbability = new Double(properties.getProperty("computenode.fail_probability")); failProbability = _failProbability; lg.log(Level.FINER, "ComputeNode " + id + ": under load threshhold = " + underLoadThreshold); lg.log(Level.FINER, "ComputeNode " + id + ": over load threshhold = " + overLoadThreshold); lg.log(Level.FINER, "ComputeNode " + id + ": fail probability = " + failProbability); loadConstant = _loadConstant; if (loadConstant != null) lg.log(Level.FINER, "ComputeNode " + id + ": load constant = " + loadConstant); loadGaussian = _loadGaussian; if (loadGaussian != null) lg.log(Level.FINER, "ComputeNode " + id + ": load gaussian = " + loadGaussian.fst() + "," + loadGaussian.snd()); } catch (Exception e) { lg.log(Level.SEVERE, "ComputeNode " + id + ": Constructor failure! " + underLoadThreshold); e.printStackTrace(); System.exit(1); } myNodeStats = new NodeStats(); myNodeStats.setCurrentLoad(getCurrentLoad()); }
From source file:org.b3log.solo.filter.PermalinkFilter.java
/** * Tries to dispatch request to article processor. * * @param request the specified request/* ww w .j a va2 s . c o m*/ * @param response the specified response * @param chain filter chain * @throws IOException io exception * @throws ServletException servlet exception */ @Override public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { final HttpServletRequest httpServletRequest = (HttpServletRequest) request; final HttpServletResponse httpServletResponse = (HttpServletResponse) response; final String requestURI = httpServletRequest.getRequestURI(); LOGGER.log(Level.FINER, "Request URI[{0}]", requestURI); final String contextPath = Latkes.getContextPath(); final String permalink = StringUtils.substringAfter(requestURI, contextPath); if (Permalinks.invalidPermalinkFormat(permalink)) { LOGGER.log(Level.FINER, "Skip filter request[URI={0}]", permalink); chain.doFilter(request, response); return; } JSONObject article; JSONObject page = null; try { article = articleRepository.getByPermalink(permalink); if (null == article) { page = pageRepository.getByPermalink(permalink); } if (null == page && null == article) { LOGGER.log(Level.FINER, "Not found article/page with permalink[{0}]", permalink); chain.doFilter(request, response); return; } } catch (final RepositoryException e) { LOGGER.log(Level.SEVERE, "Processes article permalink filter failed", e); httpServletResponse.sendError(HttpServletResponse.SC_NOT_FOUND); return; } // If requests an article and the article need view passowrd, sends redirect to the password form if (null != article && articles.needViewPwd(httpServletRequest, article)) { try { httpServletResponse.sendRedirect(Latkes.getServePath() + "/console/article-pwd" + articles.buildArticleViewPwdFormParameters(article)); return; } catch (final Exception e) { httpServletResponse.sendError(HttpServletResponse.SC_NOT_FOUND); return; } } dispatchToArticleOrPageProcessor(request, response, article, page); }
From source file:com.ibm.team.build.internal.hjplugin.RTCLoginInfo.java
/** * Figure out the info needed to log into RTC based on a variety of ways to authenticate * It is expected that supplied values have been validated to some degree * @param project The project to be built (hence credentials needed for) may be * <code>null</code> when dealing with the global case * @param buildToolkitPath The path of the build toolkit. Could be <code>null</code> * if not using a password file// w w w.j a v a 2s . c om * @param serverUri The server to log into. Required * @param userId The user id to use. May be <code>null</code> when working with * credentials * @param password The password to use. May be <code>null</code> when working with * credentials or a password file. * @param passwordFile The file containing the password. May be <code>null</code> * when working with credentials or a password. * @param credentialsId The id of Jenkins credentials. May be <code>null</code> * when working with userId & either password/password file * @param timeout The time out to use (in seconds). Required * @throws Exception When something goes wrong determining the credentials. */ public RTCLoginInfo(Job<?, ?> project, String buildToolkitPath, String serverUri, String userId, String password, String passwordFile, String credentialsId, int timeout) throws InvalidCredentialsException { credentialsId = Util.fixEmptyAndTrim(credentialsId); password = Util.fixEmptyAndTrim(password); passwordFile = Util.fixEmptyAndTrim(passwordFile); userId = Util.fixEmptyAndTrim(userId); if (credentialsId != null) { // figure out userid & password from the credentials if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("Looking up credentials for " + //$NON-NLS-1$ "credentialId=\"" + credentialsId + //$NON-NLS-1$ "\" serverURI=\"" + serverUri + //$NON-NLS-1$ "\" project=" + (project == null ? "null" : "\"" + project.getName() + "\"")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ $NON-NLS-2$ $NON-NLS-3$ $NON-NLS-4$ } List<StandardUsernamePasswordCredentials> allMatchingCredentials = CredentialsProvider .lookupCredentials(StandardUsernamePasswordCredentials.class, project, ACL.SYSTEM, URIRequirementBuilder.fromUri(serverUri).build()); StandardUsernamePasswordCredentials credentials = CredentialsMatchers .firstOrNull(allMatchingCredentials, CredentialsMatchers.withId(credentialsId)); if (credentials != null) { this.userId = credentials.getUsername(); this.password = credentials.getPassword().getPlainText(); } else { throw new InvalidCredentialsException(Messages.RTCLoginInfo_creds_unresolvable()); } } else { this.userId = userId; if (this.userId == null) { if (passwordFile == null && password == null) { throw new InvalidCredentialsException(Messages.RTCLoginInfo_missing_creds()); } else { throw new InvalidCredentialsException(Messages.RTCLoginInfo_missing_userid()); } } if (passwordFile != null) { // figure out the password in the file if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("Looking up credentials for " + //$NON-NLS-1$ "userId=\"" + userId + //$NON-NLS-1$ "\" passwordFile=\"" + passwordFile); //$NON-NLS-1$ } try { RTCFacadeWrapper facade = RTCFacadeFactory.getFacade(buildToolkitPath, null); this.password = (String) facade.invoke("determinePassword", new Class[] { //$NON-NLS-1$ File.class, // passwordFile, Locale.class // clientLocale }, new File(passwordFile), LocaleProvider.getLocale()); } catch (Exception e) { Throwable eToReport = e; if (eToReport instanceof InvocationTargetException && e.getCause() != null) { eToReport = e.getCause(); } if (LOGGER.isLoggable(Level.FINER)) { LOGGER.log(Level.FINER, "Failed to resolve password from passwordFile=\"" + passwordFile //$NON-NLS-1$ + "\" : " + eToReport.getMessage(), e); //$NON-NLS-1$ } throw new InvalidCredentialsException( Messages.RTCLoginInfo_missing_password(passwordFile, eToReport.getMessage()), e); } } else if (password != null) { // password was given if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("Credentials supplied for " + //$NON-NLS-1$ "userId=\"" + userId + //$NON-NLS-1$ "\" password=" + (password == null ? "null" : "non-null")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } this.password = password; } else { // no password info supplied if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("No password supplied for " + //$NON-NLS-1$ "userId=\"" + userId + //$NON-NLS-1$ "\" password=" + (password == null ? "null" : "non-null")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } throw new InvalidCredentialsException(Messages.RTCLoginInfo_supply_password_file_or_password()); } } this.serverUri = serverUri; this.timeout = timeout; }
From source file:org.jenkinsci.plugins.quayio.trigger.QuayIoWebHook.java
private void trigger(StaplerResponse response, final PushEventNotification notification) throws IOException { final Jenkins jenkins = Jenkins.getInstance(); if (jenkins == null) { return;// w w w. ja v a 2 s . c o m } ACL.impersonate(ACL.SYSTEM, new Runnable() { @Override public void run() { // search all jobs for DockerHubTrigger for (ParameterizedJobMixIn.ParameterizedJob p : jenkins .getAllItems(ParameterizedJobMixIn.ParameterizedJob.class)) { QuayIoTrigger trigger = QuayIoTrigger.getTrigger(p); if (trigger == null) { logger.log(Level.FINER, "job {0} doesn't have QuayIoTrigger set", p.getName()); continue; } logger.log(Level.FINER, "Inspecting candidate job {0}", p.getName()); if (trigger.getRepositories().contains(notification.getRepository())) { schedule(new JobMixInWrapper((Job) p), notification); } } } }); }
From source file:com.cyberway.issue.crawler.datamodel.ServerCache.java
protected CrawlServer createServerFor(String s) { CrawlServer cserver = (CrawlServer) this.servers.get(s); if (cserver != null) { return cserver; }/*from w w w. ja va 2 s . c o m*/ // Ensure key is private object String skey = new String(s); cserver = new CrawlServer(skey); cserver.setSettingsHandler(settingsHandler); servers.put(skey, cserver); if (logger.isLoggable(Level.FINER)) { logger.finer("Created server " + s); } return cserver; }
From source file:org.b3log.solo.filter.PageCacheFilter.java
/** * Try to write response from cache./* ww w .j av a2 s . c o m*/ * * @param request the specified request * @param response the specified response * @param chain filter chain * @throws IOException io exception * @throws ServletException servlet exception */ @Override public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { final long startTimeMillis = System.currentTimeMillis(); request.setAttribute(Keys.HttpRequest.START_TIME_MILLIS, startTimeMillis); final HttpServletRequest httpServletRequest = (HttpServletRequest) request; final String requestURI = httpServletRequest.getRequestURI(); LOGGER.log(Level.FINER, "Request URI[{0}]", requestURI); if (StaticResources.isStatic(httpServletRequest)) { final String path = httpServletRequest.getServletPath() + httpServletRequest.getPathInfo(); LOGGER.log(Level.FINEST, "Requests a static resource, forwards to servlet[path={0}]", path); request.getRequestDispatcher(path).forward(request, response); return; } if (!Latkes.isPageCacheEnabled()) { LOGGER.log(Level.FINEST, "Page cache is disabled"); chain.doFilter(request, response); return; } final String skinDirName = (String) httpServletRequest.getAttribute(Keys.TEMAPLTE_DIR_NAME); if ("mobile".equals(skinDirName)) { // Mobile request, bypasses page caching chain.doFilter(request, response); return; } String pageCacheKey; final String queryString = httpServletRequest.getQueryString(); pageCacheKey = (String) request.getAttribute(Keys.PAGE_CACHE_KEY); if (Strings.isEmptyOrNull(pageCacheKey)) { pageCacheKey = PageCaches.getPageCacheKey(requestURI, queryString); request.setAttribute(Keys.PAGE_CACHE_KEY, pageCacheKey); } final JSONObject cachedPageContentObject = PageCaches.get(pageCacheKey, httpServletRequest, (HttpServletResponse) response); if (null == cachedPageContentObject) { LOGGER.log(Level.FINER, "Page cache miss for request URI[{0}]", requestURI); chain.doFilter(request, response); return; } final String cachedType = cachedPageContentObject.optString(PageCaches.CACHED_TYPE); try { // If cached an article that has view password, dispatches the password form if (langPropsService.get(PageTypes.ARTICLE.getLangeLabel()).equals(cachedType) && cachedPageContentObject.has(PageCaches.CACHED_PWD)) { JSONObject article = new JSONObject(); final String articleId = cachedPageContentObject.optString(PageCaches.CACHED_OID); article.put(Keys.OBJECT_ID, articleId); article.put(Article.ARTICLE_VIEW_PWD, cachedPageContentObject.optString(PageCaches.CACHED_PWD)); if (articles.needViewPwd(httpServletRequest, article)) { article = articleRepository.get(articleId); // Loads the article entity final HttpServletResponse httpServletResponse = (HttpServletResponse) response; try { httpServletResponse.sendRedirect(Latkes.getServePath() + "/console/article-pwd" + articles.buildArticleViewPwdFormParameters(article)); return; } catch (final Exception e) { httpServletResponse.sendError(HttpServletResponse.SC_NOT_FOUND); return; } } } } catch (final Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); chain.doFilter(request, response); } try { LOGGER.log(Level.FINEST, "Writes resposne for page[pageCacheKey={0}] from cache", pageCacheKey); response.setContentType("text/html"); response.setCharacterEncoding("UTF-8"); final PrintWriter writer = response.getWriter(); String cachedPageContent = cachedPageContentObject.getString(PageCaches.CACHED_CONTENT); final String topBarHTML = TopBars.getTopBarHTML((HttpServletRequest) request, (HttpServletResponse) response); cachedPageContent = cachedPageContent.replace(Common.TOP_BAR_REPLACEMENT_FLAG, topBarHTML); final String cachedTitle = cachedPageContentObject.getString(PageCaches.CACHED_TITLE); LOGGER.log(Level.FINEST, "Cached value[key={0}, type={1}, title={2}]", new Object[] { pageCacheKey, cachedType, cachedTitle }); statistics.incBlogViewCount((HttpServletRequest) request, (HttpServletResponse) response); final long endimeMillis = System.currentTimeMillis(); final String dateString = DateFormatUtils.format(endimeMillis, "yyyy/MM/dd HH:mm:ss"); final String msg = String.format("<!-- Cached by B3log Solo(%1$d ms), %2$s -->", endimeMillis - startTimeMillis, dateString); LOGGER.finer(msg); cachedPageContent += Strings.LINE_SEPARATOR + msg; writer.write(cachedPageContent); writer.flush(); writer.close(); } catch (final JSONException e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); chain.doFilter(request, response); } catch (final RepositoryException e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); chain.doFilter(request, response); } catch (final ServiceException e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); chain.doFilter(request, response); } }
From source file:org.cloudifysource.esc.driver.provisioning.openstack.OpenStackNovaClient.java
/** * Get a list of instances that match the prefix name. * /*from w w w.ja v a 2 s . co m*/ * @param prefix * The prefix to be match. * @return A list of instances prefixed by the given name. * @throws OpenstackException * Thrown when something went wrong with the request. */ public List<NovaServer> getServersByPrefix(final String prefix) throws OpenstackException { if (logger.isLoggable(Level.FINER)) { logger.log(Level.FINER, "Request=getServerWithName"); } final String response; try { response = this.doGet("servers", new String[] { "name", prefix }); } catch (OpenstackServerException e) { if (RESOURCE_NOT_FOUND_STATUS == e.getStatusCode()) { return null; } throw e; } final List<NovaServer> servers = JsonUtils.unwrapRootToList(NovaServer.class, response); final List<NovaServer> detailServers = new ArrayList<NovaServer>(servers.size()); for (final NovaServer sv : servers) { final NovaServer serverDetails = this.getServerDetails(sv.getId()); detailServers.add(serverDetails); } return detailServers; }