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:org.jamwiki.utils.WikiLogger.java

/**
 * Log a message and an exception at the {@link java.util.logging.Level#FINER}
 * level, provided that the current log level is {@link java.util.logging.Level#FINER}
 * or greater.//  ww  w. jav  a 2s .  co m
 *
 * @param msg The message to be written to the log.
 * @param thrown An exception to be written to the log.
 */
public void finer(String msg, Throwable thrown) {
    this.logger.log(Level.FINER, msg, thrown);
}

From source file:org.gameontext.map.auth.PlayerClient.java

/**
 * Obtain the apiKey for the given id, using a local cache to avoid hitting couchdb too much.
 *///w  w w . j a v a2  s  .c o  m
@Override
public String getSecretForId(String id) {
    //first.. handle our built-in key
    if (SYSTEM_ID.equals(id)) {
        return registrationSecret;
    } else if (sweepId.equals(id)) {
        return sweepSecret;
    }

    String playerSecret = null;

    TimestampedKey timedKey = playerSecrets.get(id);
    if (timedKey != null) {
        playerSecret = timedKey.getKey();
        if (!timedKey.hasExpired()) {
            // CACHED VALUE! the id has been seen, and hasn't expired. Shortcut!
            Log.log(Level.FINER, "Map using cached key for {0}", id);
            return playerSecret;
        }
    }

    TimestampedKey newKey = new TimestampedKey(hours24);
    Log.log(Level.FINER, "Map asking player service for key for id {0}", id);

    try {
        playerSecret = getPlayerSecret(id);
        newKey.setKey(playerSecret);
    } catch (WebApplicationException e) {
        if (playerSecret != null) {
            // we have a stale value, return it
            return playerSecret;
        }

        // no dice at all, rethrow
        throw e;
    }

    // replace expired timedKey with newKey always.
    playerSecrets.put(id, newKey);

    // return fetched playerSecret
    return playerSecret;
}

From source file:org.b3log.latke.plugin.AbstractPlugin.java

/**
 * Plugs with the specified data model and the args from request.
 * @param dataModel dataModel //from w w  w.  j  av  a  2  s  .  c om
 * @param context context
 * @param ret ret
 */
public void plug(final Map<String, Object> dataModel, final HTTPRequestContext context, final Object ret) {
    String content = (String) dataModel.get(Plugin.PLUGINS);

    if (null == content) {
        dataModel.put(Plugin.PLUGINS, "");
    }

    handleLangs(dataModel);
    fillDefault(dataModel);

    postPlug(dataModel, context, ret);

    content = (String) dataModel.get(Plugin.PLUGINS);
    final StringBuilder contentBuilder = new StringBuilder(content);

    contentBuilder.append(getViewContent(dataModel));

    final String pluginsContent = contentBuilder.toString();

    dataModel.put(Plugin.PLUGINS, pluginsContent);

    LOGGER.log(Level.FINER, "Plugin[name={0}] has been plugged", getName());

}

From source file:org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginH2Dao.java

@Override
public void deleteBuild(String jobFullName, int buildNumber) {
    LOGGER.log(Level.FINER, "deleteBuild({0}#{1})", new Object[] { jobFullName, buildNumber });
    try (Connection cnn = jdbcConnectionPool.getConnection()) {
        cnn.setAutoCommit(false);/*from   w  w w .j a  va2 s  . c o m*/
        Long jobPrimaryKey;
        try (PreparedStatement stmt = cnn.prepareStatement("SELECT ID FROM JENKINS_JOB WHERE FULL_NAME = ?")) {
            stmt.setString(1, jobFullName);
            try (ResultSet rst = stmt.executeQuery()) {
                if (rst.next()) {
                    jobPrimaryKey = rst.getLong(1);
                } else {
                    jobPrimaryKey = null;
                }
            }
        }
        if (jobPrimaryKey == null) {
            LOGGER.log(Level.FINE, "No record found for job {0}", new Object[] { jobFullName });
            return;
        }

        try (PreparedStatement stmt = cnn
                .prepareStatement("DELETE FROM JENKINS_BUILD WHERE JOB_ID = ? AND NUMBER = ?")) {
            stmt.setLong(1, jobPrimaryKey);
            stmt.setInt(2, buildNumber);
            int count = stmt.executeUpdate();
            LOGGER.log(Level.FINE, "deleteJob({0}#{1}): {2}", new Object[] { jobFullName, buildNumber, count });
        }
        cnn.commit();
    } catch (SQLException e) {
        throw new RuntimeSqlException(e);
    }
}

From source file:de.theit.jenkins.crowd.CrowdConfigurationService.java

/**
 * Checks whether the user is a member of the given Crowd group.
 * // w  w  w. j  av  a 2  s  .co  m
 * @param username
 *            The name of the user to check. May not be <code>null</code> or
 *            empty.
 * @param group
 *            The name of the group to check the user against. May not be
 *            <code>null</code>.
 * @return <code>true</code> if and only if the group exists, is active and
 *         the user is either a direct group member or, if nested groups may
 *         be used, a nested group member. <code>false</code> else.
 * 
 * @throws ApplicationPermissionException
 *             If the application is not permitted to perform the requested
 *             operation on the server.
 * @throws InvalidAuthenticationException
 *             If the application and password are not valid.
 * @throws OperationFailedException
 *             If the operation has failed for any other reason, including
 *             invalid arguments and the operation not being supported on
 *             the server.
 */
private boolean isGroupMember(String username, String group)
        throws ApplicationPermissionException, InvalidAuthenticationException, OperationFailedException {
    boolean retval = false;

    if (isGroupActive(group)) {
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("Checking group membership for user '" + username + "' and group '" + group + "'...");
        }
        if (this.crowdClient.isUserDirectGroupMember(username, group)) {
            retval = true;
            if (LOG.isLoggable(Level.FINER)) {
                LOG.finer("=> user is a direct group member");
            }
        } else if (this.nestedGroups && this.crowdClient.isUserNestedGroupMember(username, group)) {
            retval = true;
            if (LOG.isLoggable(Level.FINER)) {
                LOG.finer("=> user is a nested group member");
            }
        }
    }

    return retval;
}

From source file:com.ibm.datapower.amt.clientAPI.Blob.java

/**
 * Create a new blob object from a byte array. We recommend against using
 * this, especially for the long term, because it means that the entire byte
 * array will be resident in memory for the lifetime of this object. It is
 * preferred that you use the {@link #Blob(File)} constructor so that this
 * object does not trigger large memory usage.
 * /*from w w w .j  av  a2s .co  m*/
 * @param bytes
 *            the byte array that contains the binary data. This class will
 *            reference this byte array and not copy it, so beware of making
 *            changes to your array after you use it as an argument for this
 *            constructor.
 */
public Blob(byte[] bytes) {
    final String METHOD_NAME = "Blob(byte[])"; //$NON-NLS-1$
    String message = "First 20 bytes of Blob: "; //$NON-NLS-1$
    if (bytes != null) {
        this.bytes = bytes.clone();
        logger.logp(Level.FINER, CLASS_NAME, METHOD_NAME,
                "Creating Blob from byte array of length " + bytes.length); //$NON-NLS-1$

        StringBuffer buf = new StringBuffer(message);
        for (int i = 0; i < 20 && i < bytes.length; i++) {
            int a = bytes[i];
            buf.append(Integer.toHexString(a & 0xff) + " "); //message += Integer.toHexString(a & 0xff) + " "; //$NON-NLS-1$
        }
        message = buf.toString();
    }
    logger.logp(Level.FINEST, CLASS_NAME, METHOD_NAME, message);
}

From source file:com.prowidesoftware.swift.model.IBAN.java

/**
 * Gets the BBAN (custom account number) part of the IBAN
 * @return the custom account part of the IBAN or null if the IBAN has an invalid length
 * @since 7.9.7/*w w  w  .j  a  v a2 s. c  o  m*/
 * @author psantamarina
 */
public String getBban() {
    if (StringUtils.isNotEmpty(this.iban)) {
        try {
            return getBban(this.iban);
        } catch (IndexOutOfBoundsException e) {
            log.log(Level.FINER, "Invalid IBAN length in " + this.iban, e);
        }
    }
    return null;
}

From source file:be.fedict.eidviewer.lib.file.imports.EidQuickKeyXMLFile.java

private X509Certificate certificateFromBase64Data(byte[] data, String label) {
    logger.log(Level.FINER, "Gathering {0} Certificate", label);
    try {/* w  w w .  j a  v a  2  s . c  om*/
        return (X509Certificate) certificateFactory.generateCertificate(new ByteArrayInputStream(data));
    } catch (CertificateException ex) {
        logger.log(Level.SEVERE, "Failed to Convert " + label + " Certificate", ex);
        return null;
    }
}

From source file:org.geotools.data.ngi.NGISchemaReader.java

private int getCount(BufferedReader reader) {
    int featureCount = 0;
    try {/*  ww w . j av a  2 s  . c om*/
        String line = reader.readLine();
        while (line != null) {
            if (line.toUpperCase().startsWith("$RECORD")) {
                featureCount++;
            } else if (line.equalsIgnoreCase("<END>")) {
                break;
            }
            line = reader.readLine();
        }
    } catch (IOException e) {
        LOGGER.log(Level.FINER, e.getMessage(), e);
    }

    return featureCount;
}

From source file:org.b3log.solo.util.Comments.java

/**
 * Sends a notification mail to administrator for notifying the specified
 * article or page received the specified comment and original comment.
 *
 * @param articleOrPage the specified article or page
 * @param comment the specified comment//w ww.ja v a2 s .c o  m
 * @param originalComment original comment, if not exists, set it as
 * {@code null}
 * @param preference the specified preference
 * @throws IOException io exception
 * @throws JSONException json exception
 */
public static void sendNotificationMail(final JSONObject articleOrPage, final JSONObject comment,
        final JSONObject originalComment, final JSONObject preference) throws IOException, JSONException {
    final String commentEmail = comment.getString(Comment.COMMENT_EMAIL);
    final String commentId = comment.getString(Keys.OBJECT_ID);
    final String commentContent = comment.getString(Comment.COMMENT_CONTENT)
            .replaceAll(SoloServletListener.ENTER_ESC, "<br/>");

    final String adminEmail = preference.getString(Preference.ADMIN_EMAIL);
    if (adminEmail.equalsIgnoreCase(commentEmail)) {
        LOGGER.log(Level.FINER, "Do not send comment notification mail to admin itself[{0}]", adminEmail);
        return;
    }

    if (null != originalComment && comment.has(Comment.COMMENT_ORIGINAL_COMMENT_ID)) {
        final String originalEmail = originalComment.getString(Comment.COMMENT_EMAIL);
        if (originalEmail.equalsIgnoreCase(adminEmail)) {
            LOGGER.log(Level.FINER,
                    "Do not send comment notification mail to admin while the specified comment[{0}] is an reply",
                    commentId);
            return;
        }
    }

    final String blogTitle = preference.getString(Preference.BLOG_TITLE);
    final String blogHost = preference.getString(Preference.BLOG_HOST);
    boolean isArticle = true;
    String title = articleOrPage.optString(Article.ARTICLE_TITLE);
    if (Strings.isEmptyOrNull(title)) {
        title = articleOrPage.getString(Page.PAGE_TITLE);
        isArticle = false;
    }

    final String commentSharpURL = comment.getString(Comment.COMMENT_SHARP_URL);
    final Message message = new Message();
    message.setFrom(adminEmail);
    message.addRecipient(adminEmail);
    String mailSubject = null;
    String articleOrPageURL = null;
    String mailBody = null;
    if (isArticle) {
        mailSubject = blogTitle + ": New comment on article [" + title + "]";
        articleOrPageURL = "http://" + blogHost + articleOrPage.getString(Article.ARTICLE_PERMALINK);
        mailBody = COMMENT_MAIL_HTML_BODY.replace("{articleOrPage}", "Article");
    } else {
        mailSubject = blogTitle + ": New comment on page [" + title + "]";
        articleOrPageURL = "http://" + blogHost + articleOrPage.getString(Page.PAGE_PERMALINK);
        mailBody = COMMENT_MAIL_HTML_BODY.replace("{articleOrPage}", "Page");
    }

    message.setSubject(mailSubject);
    final String commentName = comment.getString(Comment.COMMENT_NAME);
    final String commentURL = comment.getString(Comment.COMMENT_URL);
    String commenter = null;
    if (!"http://".equals(commentURL)) {
        commenter = "<a target=\"_blank\" " + "href=\"" + commentURL + "\">" + commentName + "</a>";
    } else {
        commenter = commentName;
    }

    mailBody = mailBody.replace("{articleOrPageURL}", articleOrPageURL).replace("{title}", title)
            .replace("{commentContent}", commentContent)
            .replace("{commentSharpURL}", blogHost + commentSharpURL).replace("{commenter}", commenter);
    message.setHtmlBody(mailBody);

    LOGGER.log(Level.FINER, "Sending a mail[mailSubject={0}, mailBody=[{1}] to admin[email={2}]",
            new Object[] { mailSubject, mailBody, adminEmail });
    MAIL_SVC.send(message);
}