Example usage for java.util.logging Level FINEST

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

Introduction

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

Prototype

Level FINEST

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

Click Source Link

Document

FINEST indicates a highly detailed tracing message.

Usage

From source file:org.apache.bval.cdi.BValExtension.java

public <A> void processAnnotatedType(final @Observes ProcessAnnotatedType<A> pat) {
    if (!isExecutableValidationEnabled) {
        return;// w  w w. ja  v a2s.  c o m
    }

    final AnnotatedType<A> annotatedType = pat.getAnnotatedType();

    if (!annotatedTypeFilter.accept(annotatedType)) {
        return;
    }

    final Class<A> javaClass = annotatedType.getJavaClass();
    final int modifiers = javaClass.getModifiers();
    if (!javaClass.isInterface() && !Modifier.isFinal(modifiers) && !Modifier.isAbstract(modifiers)) {
        try {
            ensureFactoryValidator();
            try {
                final BeanDescriptor classConstraints = validator.getConstraintsForClass(javaClass);
                if (annotatedType.isAnnotationPresent(ValidateOnExecution.class)
                        || hasValidationAnnotation(annotatedType.getMethods())
                        || hasValidationAnnotation(annotatedType.getConstructors())
                        || classConstraints != null && (validBean && classConstraints.isBeanConstrained()
                                || validConstructors && !classConstraints.getConstrainedConstructors().isEmpty()
                                || validBusinessMethods && !classConstraints
                                        .getConstrainedMethods(MethodType.NON_GETTER).isEmpty()
                                || validGetterMethods && !classConstraints
                                        .getConstrainedMethods(MethodType.GETTER).isEmpty())) {
                    final BValAnnotatedType<A> bValAnnotatedType = new BValAnnotatedType<A>(annotatedType);
                    pat.setAnnotatedType(bValAnnotatedType);
                }
            } catch (final NoClassDefFoundError ncdfe) {
                // skip
            }
        } catch (final ValidationException ve) {
            LOGGER.log(Level.FINEST, ve.getMessage(), ve);
        } catch (final Exception e) { // just info
            LOGGER.log(Level.INFO, e.getMessage());
        }
    }
}

From source file:org.activiti.cycle.impl.connector.signavio.SignavioConnector.java

public boolean login(String username, String password) {
    try {/*from  w  ww.j a  v  a  2  s . co  m*/
        Client client = initClient();

        log.info("Logging into Signavio on url: " + conf.getLoginUrl());

        Reference loginRef = new Reference(conf.getLoginUrl());

        // Login a user
        Form loginForm = new Form();
        // loginForm.add("mode", "external");
        loginForm.add("name", username);
        loginForm.add("password", password);
        loginForm.add("tokenonly", "true");
        // loginForm.add("serverSecurityId", "000000");
        // loginForm.add("remember", "on");
        // loginForm.add("fragment", "");
        Representation loginRep = loginForm.getWebRepresentation();

        Request loginRequest = new Request(Method.POST, loginRef, loginRep);
        Response loginResponse = client.handle(loginRequest);

        if (log.isLoggable(Level.FINEST)) {
            Series<CookieSetting> cookieSentByServer = loginResponse.getCookieSettings();
            for (Iterator<Entry<String, String>> it = cookieSentByServer.getValuesMap().entrySet()
                    .iterator(); it.hasNext();) {
                Entry<String, String> cookieParam = (Entry<String, String>) it.next();
                Cookie tempCookie = new Cookie(cookieParam.getKey(), cookieParam.getValue());
                securityCookieList.add(tempCookie);
            }
        }

        log.finest("SecurityCookieList: " + securityCookieList);
        securityToken = loginResponse.getEntity().getText();
        log.finest("SecurityToken: " + securityToken);

        if (log.isLoggable(Level.FINEST)) {
            SignavioLogHelper.logCookieAndBody(log, loginResponse);
        }

        if (securityToken != null && securityToken.length() != 0) {
            return true;
        } else {
            return false;
        }
    } catch (Exception ex) {
        throw new RepositoryException("Exception during login to Signavio", ex);
    }
}

From source file:org.jamwiki.utils.WikiLogger.java

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

From source file:Peer.java

@Override
public boolean insert(String word, String def, Level logLevel) throws Exception {
    lg.log(Level.FINEST, "insert Entry");

    // Max key value
    Key max = new Key(BigInteger.valueOf((int) Math.pow(2, hasher.getBitSize()))).pred();

    // Get key hash 
    Key key = hasher.getHash(word);

    lg.log(Level.FINER, " Hashed word " + word + " with definition " + def + " has key " + key);

    // If this peer knows the which peer that key belongs to ...
    if (//from www .j  a va2 s  .  c o  m
    // Normal ascending rande
    pred == null || (key.compare(pred) > 0 && key.compare(nodeid) <= 0)
    // Modulo range 
            || (pred.compare(nodeid) > 0 && (key.compare(pred) > 0 && key.compare(max) <= 0)
                    || (key.compare(nodeid) <= 0))) {
        lg.log(logLevel,
                "(insert)Peer " + nodeid + " should have word " + word + "(" + def + ") with key " + key);
        dict.put(word, def);
        lg.log(Level.FINEST, "insert Exit");
        return true;
    }

    // ... else find the successor through the finer table
    Key closestNode = ft.getClosestSuccessor(key);

    lg.log(logLevel, "(insert)Peer " + nodeid + " should NOT have word " + word + "(" + def + ") with key "
            + key + " ... calling insert on the best finger table match " + closestNode);

    PeerInterface peer = getPeer(closestNode);
    lg.log(Level.FINEST, "insert Exit");
    return peer.insert(word, def, logLevel);
}

From source file:edu.umass.cs.gigapaxos.FailureDetection.java

protected void receive(FailureDetectionPacket<NodeIDType> fdp) {
    log.log(Level.FINEST, "{0}{1}{2}{3}",
            new Object[] { "Node ", this.myID, " received ping from node ", fdp.senderNodeID });
    this.heardFrom(fdp.senderNodeID);
}

From source file:jenkins.plugins.openstack.compute.SlaveOptionsDescriptor.java

@Restricted(DoNotUse.class)
@InjectOsAuth// w  w w  . jav  a  2s.co  m
public ListBoxModel doFillHardwareIdItems(@QueryParameter String hardwareId, @QueryParameter String endPointUrl,
        @QueryParameter String identity, @QueryParameter String credential, @QueryParameter String zone) {

    ListBoxModel m = new ListBoxModel();
    m.add("None specified", "");

    try {
        final Openstack openstack = Openstack.Factory.get(endPointUrl, identity, credential, zone);
        for (Flavor flavor : openstack.getSortedFlavors()) {
            m.add(String.format("%s (%s)", flavor.getName(), flavor.getId()), flavor.getId());
        }
        return m;
    } catch (AuthenticationException | FormValidation | ConnectionException ex) {
        LOGGER.log(Level.FINEST, "Openstack call failed", ex);
    } catch (Exception ex) {
        LOGGER.log(Level.SEVERE, ex.getMessage(), ex);
    }

    if (Util.fixEmpty(hardwareId) != null) {
        m.add(hardwareId);
    }

    return m;
}

From source file:net.elasticgrid.rackspace.common.RackspaceConnection.java

/**
 * Make a http request and process the response. This method also performs automatic retries.
 *
 * @param request  the HTTP method to use (GET, POST, DELETE, etc)
 * @param respType the class that represents the desired/expected return type
 * @return the unmarshalled entity//from  w  w w .ja v a 2  s.  c om
 * @throws RackspaceException
 * @throws IOException        if there is an I/O exception
 * @throws HttpException      if there is an HTTP exception
 * @throws JiBXException      if the result can't be unmarshalled
 */
@SuppressWarnings("unchecked")
protected <T> T makeRequest(HttpRequestBase request, Class<T> respType)
        throws HttpException, IOException, JiBXException, RackspaceException {

    if (!authenticated)
        authenticate();

    // add auth params, and protocol specific headers
    request.addHeader("X-Auth-Token", getAuthToken());

    // set accept and content-type headers
    request.setHeader("Accept", "application/xml; charset=UTF-8");
    request.setHeader("Accept-Encoding", "gzip");
    request.setHeader("Content-Type", "application/xml; charset=UTF-8");

    // send the request
    T result = null;
    boolean done = false;
    int retries = 0;
    boolean doRetry = false;
    RackspaceException error = null;
    do {
        HttpResponse response = null;
        if (retries > 0)
            logger.log(Level.INFO, "Retry #{0}: querying via {1} {2}",
                    new Object[] { retries, request.getMethod(), request.getURI() });
        else
            logger.log(Level.INFO, "Querying via {0} {1}",
                    new Object[] { request.getMethod(), request.getURI() });

        if (logger.isLoggable(Level.FINEST) && request instanceof HttpEntityEnclosingRequestBase) {
            HttpEntity entity = ((HttpEntityEnclosingRequestBase) request).getEntity();
            if (entity instanceof EntityTemplate) {
                EntityTemplate template = (EntityTemplate) entity;
                ByteArrayOutputStream baos = null;
                try {
                    baos = new ByteArrayOutputStream();
                    template.writeTo(baos);
                    logger.log(Level.FINEST, "Request body:\n{0}", baos.toString());
                } finally {
                    IOUtils.closeQuietly(baos);
                }
            }
        }

        InputStream entityStream = null;
        HttpEntity entity = null;

        if (logger.isLoggable(Level.FINEST)) {
            response = getHttpClient().execute(request);
            entity = response.getEntity();
            try {
                entityStream = entity.getContent();
                logger.log(Level.FINEST, "Response body on " + request.getURI() + " via " + request.getMethod()
                        + ":\n" + IOUtils.toString(entityStream));
            } finally {
                IOUtils.closeQuietly(entityStream);
            }
        }

        response = getHttpClient().execute(request);
        int statusCode = response.getStatusLine().getStatusCode();
        entity = response.getEntity();

        switch (statusCode) {
        case 200:
        case 202:
        case 203:
            try {
                entityStream = entity.getContent();
                IBindingFactory bindingFactory = BindingDirectory.getFactory(respType);
                IUnmarshallingContext unmarshallingCxt = bindingFactory.createUnmarshallingContext();
                result = (T) unmarshallingCxt.unmarshalDocument(entityStream, "UTF-8");
            } finally {
                entity.consumeContent();
                IOUtils.closeQuietly(entityStream);
            }
            done = true;
            break;
        case 503: // service unavailable
            logger.log(Level.WARNING, "Service unavailable on {0} via {1}. Will retry in {2} seconds.",
                    new Object[] { request.getURI(), request.getMethod(), Math.pow(2.0, retries + 1) });
            doRetry = true;
            break;
        case 401: // unauthorized
            logger.warning("Not authenticated or authentication token expired. Authenticating...");
            authenticate();
            doRetry = true;
            break;
        case 417:
            throw new RackspaceException(new IllegalArgumentException("Some parameters are invalid!")); // TODO: temp hack 'til Rackspace API is fixed!
        case 400:
        case 500:
        default:
            try {
                entityStream = entity.getContent();
                IBindingFactory bindingFactory = BindingDirectory.getFactory(CloudServersAPIFault.class);
                IUnmarshallingContext unmarshallingCxt = bindingFactory.createUnmarshallingContext();
                CloudServersAPIFault fault = (CloudServersAPIFault) unmarshallingCxt
                        .unmarshalDocument(entityStream, "UTF-8");
                done = true;
                throw new RackspaceException(fault.getCode(), fault.getMessage(), fault.getDetails());
            } catch (JiBXException e) {
                response = getHttpClient().execute(request);
                entity = response.getEntity();
                entityStream = entity.getContent();
                logger.log(Level.SEVERE, "Can't unmarshal response from " + request.getURI() + " via "
                        + request.getMethod() + ":" + IOUtils.toString(entityStream));
                e.printStackTrace();
                throw e;
            } finally {
                entity.consumeContent();
                IOUtils.closeQuietly(entityStream);
            }
        }

        if (doRetry) {
            retries++;
            if (retries > maxRetries) {
                throw new HttpException("Number of retries exceeded for " + request.getURI(), error);
            }
            doRetry = false;
            try {
                Thread.sleep((int) Math.pow(2.0, retries) * 1000);
            } catch (InterruptedException ex) {
                // do nothing
            }
        }
    } while (!done);

    return result;
}

From source file:com.sencko.basketball.stats.advanced.FIBAJsonParser.java

private static Game getFromCache(String cacheName) throws FileNotFoundException, IOException {
    File f = new File("archive.zip");
    logger.log(Level.FINEST, "Loading file {0} from cache", cacheName);
    if (f.exists()) {
        try (ZipFile file = new ZipFile(f)) {
            ZipEntry entry = file.getEntry(cacheName);
            if (entry != null) {
                try (InputStream stream = file.getInputStream(entry)) {
                    return readGameFromStream(stream);
                }/*from  w  w w  .jav  a 2s  .c o m*/
            }
        }
    }
    return null;
}

From source file:edu.memphis.ccrg.lida.proceduralmemory.ProceduralMemoryImpl.java

/**
 * Add {@link Condition} c to the condition pool if it is not already stored. </br>
 * Returns the stored condition with same id as c.</br>
 * This method is intended to be used only by {@link SchemeImpl} to ensure that all schemes 
 * in the {@link ProceduralMemory} share the same condition instances.
 * @param c the condition to add to the condition pool.
 * @return c or the stored condition with same id as c
 *///from  w  w w.  j a  va 2 s. c om
Condition addCondition(Condition c) {
    if (c == null) {
        logger.log(Level.WARNING, "Cannot add null condition", TaskManager.getCurrentTick());
        return null;
    }
    Condition stored = conditionPool.get(c.getConditionId());
    if (stored == null) {
        logger.log(Level.FINEST, "New Condition {1} added to condition pool.",
                new Object[] { TaskManager.getCurrentTick(), c });
        c.setDecayStrategy(conditionDecay);
        conditionPool.put(c.getConditionId(), c);
        stored = c;
    }
    return stored;
}