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.jenkinsci.plugins.registry.notification.webhook.JSONWebHook.java

private WebHookPayload parse(StaplerRequest req) throws IOException {
    //TODO Actually test what duckerhub is really sending
    String body = IOUtils.toString(req.getInputStream(), req.getCharacterEncoding());
    String contentType = req.getContentType();
    if (contentType != null && contentType.startsWith("application/x-www-form-urlencoded")) {
        body = URLDecoder.decode(body, req.getCharacterEncoding());
    }//from  ww  w .  jav a 2s.c  o  m
    logger.log(Level.FINER, "Received commit hook notification : {0}", body);
    try {
        JSONObject payload = JSONObject.fromObject(body);
        return createPushNotification(payload);
    } catch (Exception e) {
        logger.log(Level.SEVERE, "Could not parse the web hook payload!", e);
        return null;
    }
}

From source file:edu.umass.cs.nio.AbstractPacketDemultiplexer.java

protected boolean handleMessageSuper(byte[] msg, NIOHeader header) throws JSONException {
    NIOInstrumenter.incrRcvd();//w w w .java  2  s.c om
    MessageType message = null;
    Level level = Level.FINEST;
    try {
        message = processHeader(msg, header);
    } catch (Exception | Error e) {
        e.printStackTrace();
        return false;
    }
    Integer type = message != null ? getPacketType(message) : null;
    log.log(level, "{0} handling type {1} message {2}:{3}",
            new Object[] { this, type, header, log.isLoggable(level) ? new Stringer(msg) : msg });

    if (type == null || !this.demuxMap.containsKey(type)) {
        /* It is natural for some demultiplexers to not handle some packet
         * types, so it is not a "bad" thing that requires a warning log. */
        log.log(Level.FINER, "{0} ignoring unknown packet type: {1}: {2}",
                new Object[] { this, type, message });
        return false;
    }
    Tasker tasker = new Tasker(message, this.demuxMap.get(type));
    if (this.myThreadPoolSize == 0 || isOrderPreserving(message)) {
        log.log(Level.FINER, "{0} handling message type {1} in selector thread; this can cause "
                + "deadlocks if the handler involves blocking operations", new Object[] { this, type });
        // task better be lightning quick
        tasker.run();
    } else
        try {
            log.log(Level.FINEST, "{0} invoking {1}.handleMessage({2})",
                    new Object[] { this, tasker.pd, message });
            // task should still be non-blocking
            executor.schedule(tasker, emulateDelays ? JSONDelayEmulator.getEmulatedDelay() : 0,
                    TimeUnit.MILLISECONDS);
        } catch (RejectedExecutionException ree) {
            if (!executor.isShutdown())
                ree.printStackTrace();
            return false;
        }
    /* Note: executor.submit() consistently yields poorer performance than
     * scheduling at 0 as above even though they are equivalent. Probably
     * garbage collection or heap optimization issues. */
    return true;
}

From source file:org.aselect.server.request.handler.xsaml20.ProxyHTTPMetadataProvider.java

/**
 * Fetches the metadata from the remote server and unmarshalls it.
 * /*from   ww w  .  j  ava  2s  . com*/
 * @return the unmarshalled metadata
 * @throws IOException
 *             thrown if the metadata can not be fetched from the remote server
 * @throws UnmarshallingException
 *             thrown if the metadata can not be unmarshalled
 */
@Override
protected XMLObject fetchMetadata() throws IOException, UnmarshallingException {
    _systemLogger.log(Level.FINEST, "Fetching metadata document from remote server");

    GetMethod getMethod = new GetMethod(getMetadataURI());
    if (proxyhttpClient.getState().getCredentials(proxyauthScope) != null) {
        _systemLogger.log(Level.FINEST, "Using BASIC authentication when retrieving metadata");
        getMethod.setDoAuthentication(true);
    }
    proxyhttpClient.executeMethod(getMethod);

    _systemLogger.log(Level.FINER,
            "Retrieved the following metadata document\n{}" + getMethod.getResponseBodyAsString());
    XMLObject metadata = unmarshallMetadata(getMethod.getResponseBodyAsStream());

    _systemLogger.log(Level.FINEST, "Unmarshalled metadata from remote server");
    return metadata;

}

From source file:com.esri.gpt.server.csw.client.CswClient.java

/**
 * Submit HTTP Request (Both GET and POST). Return InputStream object from the response
 * /* w  w  w  . j  a  va2s.  c om*/
 * Submit an HTTP request.
 * @return Response in plain text.
 * 
 * @param method    HTTP Method. for example "POST", "GET"
 * @param urlString    URL to send HTTP Request to
 * @param postdata    Data to be posted
 * @param usr    Username
 * @param pwd    Password
 * @throws IOException in IOException
 * @throws  java.net.SocketTimeoutException if connect or read timeout
 */
public InputStream submitHttpRequest(String method, String urlString, String postdata, String usr, String pwd)
        throws IOException {

    if (LOG.isLoggable(Level.FINER)) {
        LOG.finer("Data being sent.  URL = " + urlString + "\n Data = " + postdata);
    }

    urlString = Utils.chkStr(urlString);
    urlString = urlString.replaceAll("\\n", "");
    urlString = urlString.replaceAll("\\t", "");
    urlString = urlString.replaceAll("\\r", "");
    urlString = urlString.replaceAll(" ", "");

    HttpClientRequest client = HttpClientRequest.newRequest();
    client.setBatchHttpClient(getBatchHttpClient());
    client.setUrl(urlString);
    client.setRetries(1);

    usr = Val.chkStr(usr);
    pwd = Val.chkStr(pwd);
    if (usr.length() > 0 || pwd.length() > 0) {
        CredentialProvider provider = new CredentialProvider(usr, pwd);
        client.getCredentialProvider();
        client.setCredentialProvider(provider);
    }
    if (this.getReadTimeout() > 0) {
        client.setResponseTimeOutMs(this.getReadTimeout());
    }
    if (this.getConnectTimeout() > 0) {
        client.setConnectionTimeMs(this.getConnectTimeout());
    }

    // Send a request
    if (Val.chkStr(method).equalsIgnoreCase("post")) {
        ContentProvider contentProvider = new StringProvider(postdata, "text/xml");
        client.setContentProvider(contentProvider);

    } else {
        client.setMethodName(MethodName.GET);
    }

    String response = client.readResponseAsCharacters();
    LOG.finer(" CSW Response : " + response);
    return new ByteArrayInputStream(response.getBytes("UTF-8"));

}

From source file:com.google.enterprise.connector.salesforce.BaseTraversalManager.java

/**
 * The sets the batch limit (num of docs to return to it)..
 * <p>//from w  ww .  j  ava2 s .c om
 * the checkpoint entered into this method is the numeric checkpoint used by
 * the connector/connectormanager and not the same setting as the
 * LAST_SYNC_DATE used by the quartz scheduler.
 * </p>
 * 
 * @param checkpoint
 *            the checkpoint file the traversal manager should resume from
 * @return DocumentList to return back to the connector-manager
 */
public DocumentList resumeTraversal(String checkpoint) {
    logger.log(Level.FINER, " resumeTraversal called checkpoint " + checkpoint);
    DocumentList rdl = traverse(checkpoint);
    return rdl;
}

From source file:com.pivotal.gemfire.tools.pulse.internal.log.PulseLogWriter.java

@Override
public boolean finerEnabled() {
    return logger.isLoggable(Level.FINER);
}

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

@Override
public void renameJob(String oldFullName, String newFullName) {
    LOGGER.log(Level.FINER, "renameJob({0}, {1})", new Object[] { oldFullName, newFullName });
    try (Connection cnn = jdbcConnectionPool.getConnection()) {
        cnn.setAutoCommit(false);/* ww w. ja v  a 2 s  .  c  o  m*/
        try (PreparedStatement stmt = cnn
                .prepareStatement("UPDATE JENKINS_JOB SET FULL_NAME = ? WHERE FULL_NAME = ?")) {
            stmt.setString(1, newFullName);
            stmt.setString(2, oldFullName);
            int count = stmt.executeUpdate();
            LOGGER.log(Level.FINE, "renameJob({0}, {1}): {2}",
                    new Object[] { oldFullName, newFullName, count });
        }
        cnn.commit();
    } catch (SQLException e) {
        throw new RuntimeSqlException(e);
    }
}

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

/**
 * Removes a page specified by the given page id.
 *
 * @param pageId the given page id//from   w w w.  j  a v  a  2  s  . co m
 * @throws ServiceException service exception
 */
public void removePage(final String pageId) throws ServiceException {
    final Transaction transaction = pageRepository.beginTransaction();
    try {
        LOGGER.log(Level.FINER, "Removing a page[id={0}]", pageId);
        removePageComments(pageId);
        pageRepository.remove(pageId);

        transaction.commit();

    } catch (final Exception e) {
        if (transaction.isActive()) {
            transaction.rollback();
        }

        LOGGER.log(Level.SEVERE, "Removes a page[id=" + pageId + "] failed", e);

        throw new ServiceException(e);
    }
}

From source file:com.pivotal.gemfire.tools.pulse.internal.log.PulseLogWriter.java

@Override
public void finer(String msg, Throwable ex) {
    logger.logp(Level.FINER, "", "", msg, ex);
}

From source file:org.apache.cxf.sts.claims.LdapClaimsHandler.java

public ProcessedClaimCollection retrieveClaimValues(ClaimCollection claims, ClaimsParameters parameters) {
    String user = null;//w w  w  .ja  v  a2  s  . com
    boolean useLdapLookup = false;

    Principal principal = parameters.getPrincipal();
    if (principal instanceof KerberosPrincipal) {
        KerberosPrincipal kp = (KerberosPrincipal) principal;
        StringTokenizer st = new StringTokenizer(kp.getName(), "@");
        user = st.nextToken();
    } else if (principal instanceof X500Principal) {
        X500Principal x500p = (X500Principal) principal;
        LOG.warning("Unsupported principal type X500: " + x500p.getName());
        return new ProcessedClaimCollection();
    } else if (principal != null) {
        user = principal.getName();
        if (user == null) {
            LOG.warning("User must not be null");
            return new ProcessedClaimCollection();
        }
        useLdapLookup = LdapUtils.isDN(user);

    } else {
        LOG.warning("Principal is null");
        return new ProcessedClaimCollection();
    }

    if (LOG.isLoggable(Level.FINEST)) {
        LOG.finest("Retrieve claims for user " + user);
    }

    Map<String, Attribute> ldapAttributes = null;
    if (useLdapLookup) {
        AttributesMapper mapper = new AttributesMapper() {
            public Object mapFromAttributes(Attributes attrs) throws NamingException {
                Map<String, Attribute> map = new HashMap<String, Attribute>();
                NamingEnumeration<? extends Attribute> attrEnum = attrs.getAll();
                while (attrEnum.hasMore()) {
                    Attribute att = attrEnum.next();
                    map.put(att.getID(), att);
                }
                return map;
            }
        };

        Object result = ldap.lookup(user, mapper);
        ldapAttributes = CastUtils.cast((Map<?, ?>) result);
    } else {
        List<String> searchAttributeList = new ArrayList<String>();
        for (Claim claim : claims) {
            if (getClaimsLdapAttributeMapping().keySet().contains(claim.getClaimType().toString())) {
                searchAttributeList.add(getClaimsLdapAttributeMapping().get(claim.getClaimType().toString()));
            } else {
                if (LOG.isLoggable(Level.FINER)) {
                    LOG.finer("Unsupported claim: " + claim.getClaimType());
                }
            }
        }

        String[] searchAttributes = null;
        searchAttributes = searchAttributeList.toArray(new String[searchAttributeList.size()]);

        ldapAttributes = LdapUtils.getAttributesOfEntry(ldap, this.userBaseDn, this.getObjectClass(),
                this.getUserNameAttribute(), user, searchAttributes);
    }

    if (ldapAttributes == null || ldapAttributes.size() == 0) {
        //No result
        if (LOG.isLoggable(Level.INFO)) {
            LOG.finest("User '" + user + "' not found");
        }
        return new ProcessedClaimCollection();
    }

    ProcessedClaimCollection claimsColl = new ProcessedClaimCollection();

    for (Claim claim : claims) {
        URI claimType = claim.getClaimType();
        String ldapAttribute = getClaimsLdapAttributeMapping().get(claimType.toString());
        Attribute attr = ldapAttributes.get(ldapAttribute);
        if (attr == null) {
            if (LOG.isLoggable(Level.FINEST)) {
                LOG.finest("Claim '" + claim.getClaimType() + "' is null");
            }
        } else {
            ProcessedClaim c = new ProcessedClaim();
            c.setClaimType(claimType);
            c.setPrincipal(principal);

            StringBuilder claimValue = new StringBuilder();
            try {
                NamingEnumeration<?> list = (NamingEnumeration<?>) attr.getAll();
                while (list.hasMore()) {
                    Object obj = list.next();
                    if (!(obj instanceof String)) {
                        LOG.warning("LDAP attribute '" + ldapAttribute + "' has got an unsupported value type");
                        break;
                    }
                    String itemValue = (String) obj;
                    if (this.isX500FilterEnabled()) {
                        try {
                            X500Principal x500p = new X500Principal(itemValue);
                            itemValue = x500p.getName();
                            int index = itemValue.indexOf('=');
                            itemValue = itemValue.substring(index + 1, itemValue.indexOf(',', index));
                        } catch (Exception ex) {
                            //Ignore, not X500 compliant thus use the whole string as the value
                        }
                    }
                    claimValue.append(itemValue);
                    if (list.hasMore()) {
                        claimValue.append(this.getDelimiter());
                    }
                }
            } catch (NamingException ex) {
                LOG.warning("Failed to read value of LDAP attribute '" + ldapAttribute + "'");
            }

            c.addValue(claimValue.toString());
            // c.setIssuer(issuer);
            // c.setOriginalIssuer(originalIssuer);
            // c.setNamespace(namespace);
            claimsColl.add(c);
        }
    }

    return claimsColl;
}