Example usage for java.util.logging Level FINER

List of usage examples for java.util.logging Level FINER

Introduction

In this page you can find the example usage for java.util.logging Level FINER.

Prototype

Level FINER

To view the source code for java.util.logging Level FINER.

Click Source Link

Document

FINER indicates a fairly detailed tracing message.

Usage

From source file:com.machinepublishers.jbrowserdriver.LogsServer.java

public void javascript(String message) {
    Settings settings = SettingsManager.settings();
    if (settings != null && settings.logJavascript()) {
        handleMessage(message, javascript, Level.FINER, "javascript", settings);
    }//from  w w w  .j av a  2  s. c  om
}

From source file:com.granule.json.utils.internal.JSONSAXHandler.java

public void startDocument() throws SAXException {
    if (logger.isLoggable(Level.FINER))
        logger.entering(className, "startDocument()");

    startJSON();//from   w ww.j  a  va2 s. c  o m

    if (logger.isLoggable(Level.FINER))
        logger.exiting(className, "startDocument()");
}

From source file:org.jenkinsci.plugins.dockerhub.notification.DockerHubWebHook.java

private void trigger(StaplerResponse response, final WebHookPayload hookPayload) throws IOException {
    final Jenkins jenkins = Jenkins.getInstance();
    if (jenkins == null) {
        return;// www.  ja  v  a2s  . co  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)) {
                DockerHubTrigger trigger = DockerHubTrigger.getTrigger(p);
                if (trigger == null) {
                    logger.log(Level.FINER, "job {0} doesn't have DockerHubTrigger set", p.getName());
                    continue;
                }
                logger.log(Level.FINER, "Inspecting candidate job {0}", p.getName());
                if (trigger.getAllRepoNames().contains(hookPayload.getRepoName())) {
                    schedule((Job) p, hookPayload);
                }
            }
        }
    });
    response.sendRedirect("../");
}

From source file:org.apache.oodt.cas.filemgr.versioning.VersioningUtils.java

public static void createBasicDataStoreRefsHierarchical(List<Reference> references) {
    // file:///www/folder1
    // file:///www/folder1/file1
    // file:///www/folder1/file2
    // file:///www/folder1/folder2/
    // file:///www/folder1/folder2/file3

    // toDir: file:///www/myfolder/product1
    // origDir: file:///www/folder1

    String toDirRef = references.get(0).getDataStoreReference();
    String origDirRef = references.get(0).getOrigReference();
    String origDirRefName = new File(origDirRef).getName();

    for (Reference r : references) {
        // don't bother with the first one, because it's already set
        // correctly
        if (r.getOrigReference().equals(origDirRef)) {
            continue;
        }/*from   w w  w.  ja  va2s . c  o  m*/

        // get the first occurence of the origDir name in the string
        // then, the ref becomes:
        // toDir+r.getOrigRef.substring(first occurence of
        // origDir).substring(first occurence of '/'+1)

        String dataStoreRef = toDirRef;
        int firstOccurenceOfOrigDir = r.getOrigReference().indexOf(origDirRefName);
        String tmpRef = r.getOrigReference().substring(firstOccurenceOfOrigDir);
        LOG.log(Level.FINER, "tmpRef: " + tmpRef);
        int firstOccurenceSlash = tmpRef.indexOf("/");
        dataStoreRef += tmpRef.substring(firstOccurenceSlash + 1);

        LOG.log(Level.FINE, "VersioningUtils: Generated data store ref: " + dataStoreRef + " from origRef: "
                + r.getOrigReference());
        r.setDataStoreReference(dataStoreRef);
    }

}

From source file:com.reachcall.pretty.http.ProxyServlet.java

@SuppressWarnings("unchecked")
public void copyHeaders(HttpServletRequest req, HttpRequestBase method) {
    Enumeration names = req.getHeaderNames();

    while (names.hasMoreElements()) {
        String name = (String) names.nextElement();

        if (name.equalsIgnoreCase(HEADER_CONTENT_LENTH)) {
            continue;
        }//from   ww w  .j a va 2 s .  c  o m

        Enumeration values = req.getHeaders(name);

        while (values.hasMoreElements()) {
            String value = (String) values.nextElement();
            LOG.log(Level.FINER, "{0} : {1}", new Object[] { name, value });

            if (name.equalsIgnoreCase(HEADER_HOST) || name.equalsIgnoreCase(HEADER_X_FORWARDED_FOR)) {
                continue;
            } else {
                method.addHeader(name, value);
            }
        }

        setVHost(req.getHeader("Host"));
    }
    method.addHeader(HEADER_REMOTE_HOST, req.getRemoteAddr());
    String xff = req.getHeader(HEADER_X_FORWARDED_FOR);

    if (xff == null) {
        xff = "";
    } else {
        xff = xff + ", ";
    }

    method.addHeader(HEADER_X_FORWARDED_FOR, xff + req.getRemoteHost());

    if (req.getHeader(HEADER_X_ORIGINAL_REQUEST_URL) == null) {
        method.addHeader(HEADER_X_ORIGINAL_REQUEST_URL, req.getRequestURL().toString());
    }
}

From source file:fr.logfiletoes.TailerListenerUnit.java

public void saveToElasticsearch() {
    HttpPost elasticSearchPost = new HttpPost(
            unit.getElasticSearch().getUrl() + "/" + unit.getElasticSearch().getType());
    try {/* www.  j av a 2s. c  o m*/
        elasticSearchPost.setEntity(new StringEntity(json.toString()));
        CloseableHttpResponse execute = httpclient.execute(elasticSearchPost, context);
        if (execute.getStatusLine().getStatusCode() < 200 || execute.getStatusLine().getStatusCode() >= 300) {
            LOG.log(Level.SEVERE,
                    "Add log to ElasticSearch failed : " + execute.getStatusLine().getStatusCode());
            LOG.log(Level.SEVERE, inputSteamToString(execute.getEntity().getContent()));
        } else {
            LOG.log(Level.FINE, "Add log to ElasticSearch successful.");
            LOG.log(Level.FINER, json.toString());
        }
        EntityUtils.consume(execute.getEntity());
        execute.close();
    } catch (UnsupportedEncodingException ex) {
        LOG.log(Level.SEVERE, "Encoding exception", ex);
    } catch (IOException ex) {
        LOG.log(Level.SEVERE, "IOException", ex);
    }
}

From source file:com.granule.json.utils.internal.JSONObject.java

/**
 * Method to write out the JSON formatted object.
 * @param writer The writer to use when serializing the JSON structure.
 * @param indentDepth How far to indent the text for object's JSON format.
 * @param contentOnly Flag to debnnote whether to assign this as an attribute name, or as a nameless object.  Commonly used for serializing an array.  The Array itself has the name,   The contents are all nameless objects 
 * @param compact Flag to denote to write the JSON in compact form.  No indentions or newlines.  Setting this value to true will cause indentDepth to be ignored.
 * @throws IOException Trhown if an error occurs on write.
 *///from ww w. j  a v  a 2s  .co m
public void writeObject(Writer writer, int indentDepth, boolean contentOnly, boolean compact)
        throws IOException {
    if (logger.isLoggable(Level.FINER))
        logger.entering(className, "writeObject(Writer, int, boolean, boolean)");

    if (writer != null) {
        try {
            if (isEmptyObject()) {
                writeEmptyObject(writer, indentDepth, contentOnly, compact);
            } else if (isTextOnlyObject()) {
                writeTextOnlyObject(writer, indentDepth, contentOnly, compact);
            } else {
                writeComplexObject(writer, indentDepth, contentOnly, compact);
            }

        } catch (Exception ex) {
            IOException iox = new IOException("Error occurred on serialization of JSON text.");
            iox.initCause(ex);
            throw iox;
        }
    } else {
        throw new IOException("The writer cannot be null.");
    }

    if (logger.isLoggable(Level.FINER))
        logger.entering(className, "writeObject(Writer, int, boolean, boolean)");
}

From source file:org.jboss.arquillian.container.was.wlp_remote_8_5.WLPRestClient.java

/**
 * Calls the rest api to determine if the application server is up and
 * running.//w  ww .jav a  2s. c o m
 * 
 * @return boolean - true if the server is running
 */
public boolean isServerUp() throws ClientProtocolException, IOException {
    if (log.isLoggable(Level.FINER)) {
        log.entering(className, "isServerUp");
    }

    String hostName = String.format("https://%s:%d%s", configuration.getHostName(),
            configuration.getHttpsPort(), IBMJMX_CONNECTOR_REST);

    HttpResponse result = executor.execute(Request.Get(hostName)).returnResponse();

    if (!isSuccessful(result)) {
        throw new ClientProtocolException(
                "Could not successfully connect to REST endpoint, server returned response: " + result);
    }

    if (log.isLoggable(Level.FINER)) {
        log.exiting(className, "isServerUp");
    }
    return isSuccessful(result);
}

From source file:org.b3log.solo.service.PageMgmtService.java

/**
 * Updates a page by the specified request json object.
 *
 * @param requestJSONObject the specified request json object, for example,
 * <pre>/* w ww.j a  v a 2  s.c o  m*/
 * {
 *     "page": {
 *         "oId": "",
 *         "pageTitle": "",
 *         "pageContent": "",
 *         "pageOrder": int,
 *         "pageCommentCount": int,
 *         "pagePermalink": "",
 *         "pageCommentable": boolean,
 *         "pageType": "",
 *         "pageOpenTarget": ""
 *     }
 * }, see {@link Page} for more details
 * </pre>
 * @throws ServiceException service exception
 */
public void updatePage(final JSONObject requestJSONObject) throws ServiceException {

    final Transaction transaction = pageRepository.beginTransaction();
    try {
        final JSONObject page = requestJSONObject.getJSONObject(Page.PAGE);
        final String pageId = page.getString(Keys.OBJECT_ID);
        final JSONObject oldPage = pageRepository.get(pageId);
        final JSONObject newPage = new JSONObject(page, JSONObject.getNames(page));
        newPage.put(Page.PAGE_ORDER, oldPage.getInt(Page.PAGE_ORDER));
        newPage.put(Page.PAGE_COMMENT_COUNT, oldPage.getInt(Page.PAGE_COMMENT_COUNT));
        String permalink = page.optString(Page.PAGE_PERMALINK).trim();

        final String oldPermalink = oldPage.getString(Page.PAGE_PERMALINK);
        if (!oldPermalink.equals(permalink)) {
            if (Strings.isEmptyOrNull(permalink)) {
                permalink = "/pages/" + pageId + ".html";
            }

            if (Page.PAGE.equals(page.getString(Page.PAGE_TYPE))) {
                if (!permalink.startsWith("/")) {
                    permalink = "/" + permalink;
                }

                if (Permalinks.invalidPagePermalinkFormat(permalink)) {
                    if (transaction.isActive()) {
                        transaction.rollback();
                    }

                    throw new ServiceException(langPropsService.get("invalidPermalinkFormatLabel"));
                }

                if (!oldPermalink.equals(permalink) && permalinks.exist(permalink)) {
                    if (transaction.isActive()) {
                        transaction.rollback();
                    }

                    throw new ServiceException(langPropsService.get("duplicatedPermalinkLabel"));
                }
            }
        }

        // TODO: SBC case
        newPage.put(Page.PAGE_PERMALINK, permalink.replaceAll(" ", "-"));

        if (!oldPage.getString(Page.PAGE_PERMALINK).equals(permalink)) { // The permalink has been updated
            // Updates related comments' links
            processCommentsForPageUpdate(newPage);
        }

        // Editor type
        final JSONObject preference = preferenceQueryService.getPreference();
        newPage.put(Page.PAGE_EDITOR_TYPE, preference.optString(Preference.EDITOR_TYPE));

        pageRepository.update(pageId, newPage);

        transaction.commit();

        LOGGER.log(Level.FINER, "Updated a page[id={0}]", pageId);
    } catch (final Exception e) {
        LOGGER.log(Level.SEVERE, e.getMessage(), e);
        if (transaction.isActive()) {
            transaction.rollback();
        }

        throw new ServiceException(e);
    }
}

From source file:com.ibm.jaggr.service.impl.config.BundleVersionsHash.java

/**
 * Returns the bundle headers for the specified bundle.
 *
 * @param bundleName// ww  w  . j  ava  2s  .  c  o  m
 *            the bundle name
 * @return the bundle headers for the bundle.
 * @throws NotFoundException if no matching bundle is found.
 */
private Dictionary<?, ?> getBundleHeaders(String bundleName) throws NotFoundException {
    final String sourceMethod = "getBundleHeaders"; //$NON-NLS-1$
    boolean isTraceLogging = log.isLoggable(Level.FINER);
    if (isTraceLogging) {
        log.entering(BundleVersionsHash.class.getName(), sourceMethod, new Object[] { bundleName });
    }

    Bundle result = ".".equals(bundleName) ? contributingBundle : bundleResolver.getBundle(bundleName); //$NON-NLS-1$

    if (result == null) {
        throw new NotFoundException("Bundle " + bundleName + " not found."); //$NON-NLS-1$ //$NON-NLS-2$
    }
    if (isTraceLogging) {
        log.exiting(BundleVersionsHash.class.getName(), sourceMethod, result.getHeaders());
    }
    return result.getHeaders();
}