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:com.pivotal.gemfire.tools.pulse.internal.log.PulseLogWriter.java

@Override
public void finest(Throwable ex) {
    logger.logp(Level.FINEST, "", "", "", ex);
}

From source file:org.apache.reef.runtime.azbatch.evaluator.EvaluatorShim.java

private void onStop() {
    LOG.log(Level.FINEST, "Entering EvaluatorShim.onStop().");

    try {/*from  w w  w . jav a  2 s.  com*/
        LOG.log(Level.INFO, "Closing EvaluatorShim Control channel.");
        this.evaluatorShimCommandChannel.close();
    } catch (Exception e) {
        LOG.log(Level.SEVERE, "An unexpected exception occurred while attempting to close the EvaluatorShim "
                + "control channel.");
        throw new RuntimeException(e);
    }

    try {
        LOG.log(Level.INFO, "Closing the Remote Manager.");
        this.remoteManager.close();
    } catch (Exception e) {
        LOG.log(Level.SEVERE, "Failed to close the RemoteManager with the following exception: {0}.", e);
        throw new RuntimeException(e);
    }

    LOG.log(Level.INFO, "Shutting down the thread pool.");
    this.threadPool.shutdown();

    LOG.log(Level.FINEST, "Exiting EvaluatorShim.onStop().");
}

From source file:org.apache.reef.io.network.NetworkConnectionServiceTest.java

/**
 * NetworkService messaging rate benchmark.
 *///from  w  ww  .j  av  a2 s .  c  o m
@Test
public void testMessagingNetworkConnServiceRate() throws Exception {

    Assume.assumeFalse("Use log level INFO to run benchmarking", LOG.isLoggable(Level.FINEST));

    LOG.log(Level.FINEST, name.getMethodName());

    final int[] messageSizes = { 1, 16, 32, 64, 512, 64 * 1024, 1024 * 1024 };

    for (final int size : messageSizes) {
        final String message = StringUtils.repeat('1', size);
        final int numMessages = 300000 / (Math.max(1, size / 512));
        final Monitor monitor = new Monitor();
        final Codec<String> codec = new StringCodec();
        try (final NetworkMessagingTestService messagingTestService = new NetworkMessagingTestService(
                localAddress)) {
            messagingTestService.registerTestConnectionFactory(groupCommClientId, numMessages, monitor, codec);

            try (final Connection<String> conn = messagingTestService
                    .getConnectionFromSenderToReceiver(groupCommClientId)) {

                final long start = System.currentTimeMillis();
                try {
                    conn.open();
                    for (int count = 0; count < numMessages; ++count) {
                        // send messages to the receiver.
                        conn.write(message);
                    }
                    monitor.mwait();
                } catch (final NetworkException e) {
                    e.printStackTrace();
                    throw new RuntimeException(e);
                }
                final long end = System.currentTimeMillis();

                final double runtime = ((double) end - start) / 1000;
                LOG.log(Level.INFO, "size: " + size + "; messages/s: " + numMessages / runtime
                        + " bandwidth(bytes/s): " + ((double) numMessages * 2 * size) / runtime); // x2 for unicode chars
            }
        }
    }
}

From source file:kriswuollett.sandbox.twitter.api.streaming.gson.GsonTwitterStreamingRequest.java

@Override
public TwitterStreamingResponse call() throws Exception {
    if (listener == null)
        throw new IllegalStateException("The listener was null");

    final InputStream in;

    if (inputStream == null) {
        if (consumer == null)
            throw new IllegalStateException("The consumer was null");

        if (track == null)
            throw new IllegalStateException("The track was null");

        final HttpPost post = new HttpPost("https://stream.twitter.com/1/statuses/filter.json");

        final List<NameValuePair> nvps = new LinkedList<NameValuePair>();

        // nvps.add( new BasicNameValuePair( "track", "twitter" ) );
        // nvps.add( new BasicNameValuePair( "locations", "-74,40,-73,41" ) );
        //nvps.add( new BasicNameValuePair( "track", "'nyc','ny','new york','new york city'" ) );
        nvps.add(new BasicNameValuePair("track", track));
        post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
        post.getParams().setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, false);

        consumer.sign(post);/*  w ww.j  av  a  2s.c o  m*/

        DefaultHttpClient httpClient = new DefaultHttpClient();

        HttpResponse response = httpClient.execute(post);

        int statusCode = response.getStatusLine().getStatusCode();

        if (statusCode != HttpStatus.SC_OK)
            return new Response(false, response.getStatusLine().getReasonPhrase());

        in = response.getEntity().getContent();
    } else {
        if (consumer != null)
            throw new IllegalStateException("The consumer parameter cannot be used with inputStream");

        if (track != null)
            throw new IllegalStateException("The track parameter cannot be used with inputStream");

        in = inputStream;
    }

    reader = new JsonReader(new InputStreamReader(in, "UTF-8"));
    reader.setLenient(true);

    try {
        stack1.clear();

        ParseState state = new ParseState(State.BEGIN, null, null);

        stack1.push(state);

        while (true) {
            final JsonToken token = reader.peek();

            switch (token) {
            case BEGIN_ARRAY:
                reader.beginArray();
                if (log.isLoggable(Level.FINEST))
                    log.finest(String.format("%sBEGIN_ARRAY STATE=%s STACK_SIZE=%d", padding(stack1.size()),
                            state, stack1.size()));
                onBeginArray();
                break;
            case END_ARRAY:
                reader.endArray();
                if (log.isLoggable(Level.FINEST))
                    log.finest(String.format("%sEND_ARRAY STATE=%s STACK_SIZE=%d", padding(stack1.size()),
                            state, stack1.size()));
                onEndArray();
                break;
            case BEGIN_OBJECT:
                reader.beginObject();
                if (log.isLoggable(Level.FINEST))
                    log.finest(String.format("%sBEGIN_OBJECT STATE=%s STACK_SIZE=%d", padding(stack1.size()),
                            state, stack1.size()));
                onBeginObject();
                break;
            case END_OBJECT:
                reader.endObject();
                if (log.isLoggable(Level.FINEST))
                    log.finest(String.format("%sEND_OBJECT STATE=%s STACK_SIZE=%d", padding(stack1.size()),
                            state, stack1.size()));
                onEndObject();
                break;
            case NAME:
                String name = reader.nextName();
                if (log.isLoggable(Level.FINEST))
                    log.finest(String.format("%sNAME - %s", padding(stack1.size()), name));
                onName(name);
                break;
            case STRING:
                String s = reader.nextString();
                if (log.isLoggable(Level.FINEST))
                    log.finest(String.format("%sSTRING - %s", padding(stack1.size()), s));
                onString(s);
                break;
            case NUMBER:
                String n = reader.nextString();
                if (log.isLoggable(Level.FINEST))
                    log.finest(String.format("%sNUMBER - %s", padding(stack1.size()), n));
                onNumber(n);
                break;
            case BOOLEAN:
                boolean b = reader.nextBoolean();
                if (log.isLoggable(Level.FINEST))
                    log.finest(String.format("%sBOOLEAN - %b", padding(stack1.size()), b));
                onBoolean(b);
                break;
            case NULL:
                reader.nextNull();
                if (log.isLoggable(Level.FINEST))
                    log.finest(String.format("%sNULL", padding(stack1.size())));
                onNull();
                break;
            case END_DOCUMENT:
                if (log.isLoggable(Level.FINEST))
                    log.finest(String.format("%sEND_DOCUMENT", padding(stack1.size())));
                return new Response(true, "OK");
            }
        }
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}

From source file:edu.usu.sdl.openstorefront.service.OrientPersistenceService.java

@Override
public <T> T findById(Class<T> entity, Object id) {
    if (id == null) {
        log.log(Level.FINEST, "Id is null so return null");
        return null;
    }// w ww.  ja  v  a  2 s  .c  o  m

    OObjectDatabaseTx db = getConnection();
    T returnEntity = null;
    try {
        if (checkPkObject(db, entity, id)) {
            Map<String, Object> pkFields = findIdField(entity, id);

            if (pkFields.isEmpty()) {
                throw new OpenStorefrontRuntimeException("Unable to find PK field",
                        "Mark the Primary Key field (@PK) on the entity: " + entity.getName());
            }

            StringBuilder whereClause = new StringBuilder();
            Map<String, Object> parameters = new HashMap<>();
            for (String fieldName : pkFields.keySet()) {
                parameters.put(fieldName.replace(".", PARAM_NAME_SEPARATOR) + "Param", pkFields.get(fieldName));
                whereClause.append(" ").append(fieldName).append(" = :")
                        .append(fieldName.replace(".", PARAM_NAME_SEPARATOR)).append("Param").append(" AND");
            }
            String whereClauseString = whereClause.substring(0, whereClause.length() - 3);

            List<T> results = db.query(
                    new OSQLSynchQuery<>(
                            "select * from " + entity.getSimpleName() + " where " + whereClauseString),
                    parameters);

            if (!results.isEmpty()) {
                returnEntity = results.get(0);
            }
        } else {
            throw new OpenStorefrontRuntimeException("Id passed in doesn't match the PK type of the entity",
                    "Make sure you are passing the right PK");
        }
    } finally {
        closeConnection(db);
    }

    return returnEntity;
}

From source file:fr.logfiletoes.ElasticSearchTest.java

@Test
public void wildfly() throws IOException, InterruptedException {
    File data = Files.createTempDirectory("it_es_data-").toFile();
    Settings settings = ImmutableSettings.settingsBuilder().put("path.data", data.toString())
            .put("cluster.name", "IT-0001").build();
    Node node = NodeBuilder.nodeBuilder().local(true).settings(settings).build();
    Client client = node.client();/*from   w ww .j av a  2s  .  c  o  m*/
    node.start();
    Config config = new Config("./src/test/resources/config-wildfly-one.json");
    List<Unit> units = config.getUnits();
    assertEquals(1, units.size());
    units.get(0).start();

    // Wait store log
    Thread.sleep(3000);

    // Search log
    SearchResponse response = client.prepareSearch("logdetest").setSearchType(SearchType.DEFAULT)
            .setQuery(QueryBuilders.matchQuery("message", "Configured system properties")).setSize(1000)
            .addSort("@timestamp", SortOrder.ASC).execute().actionGet();
    if (LOG.isLoggable(Level.FINEST)) {
        for (SearchHit hit : response.getHits().getHits()) {
            LOG.finest("-----------------");
            hit.getSource().forEach((key, value) -> {
                LOG.log(Level.FINEST, "{0} = {1}", new Object[] { key, value });
            });
        }
    }

    // Get information need to test
    String expected = response.getHits().getHits()[0].getSource().get("message").toString();
    assertEquals(stacktrace, expected);

    // wait request
    Thread.sleep(10000);

    // Close tailer
    units.get(0).stop();

    // Close ElasticSearch
    node.close();

    // Clean data directory
    FileUtils.forceDelete(data);
}

From source file:org.apache.bval.jsr.DefaultMessageInterpolator.java

/**
 * Search current thread classloader for the resource bundle. If not found, search validator (this) classloader.
 *
 * @param locale The locale of the bundle to load.
 * @return the resource bundle or <code>null</code> if none is found.
 *//* w ww.ja  v a 2s .  c o  m*/
private ResourceBundle getFileBasedResourceBundle(Locale locale) {
    ResourceBundle rb = null;
    final ClassLoader classLoader = Reflection.getClassLoader(DefaultMessageInterpolator.class);
    if (classLoader != null) {
        rb = loadBundle(classLoader, locale,
                USER_VALIDATION_MESSAGES + " not found by thread local classloader");
    }

    // 2011-03-27 jw: No privileged action required.
    // A class can always access the classloader of itself and of subclasses.
    if (rb == null) {
        rb = loadBundle(getClass().getClassLoader(), locale,
                USER_VALIDATION_MESSAGES + " not found by validator classloader");
    }
    if (LOG_FINEST) {
        if (rb != null) {
            log.log(Level.FINEST, String.format("%s found", USER_VALIDATION_MESSAGES));
        } else {
            log.log(Level.FINEST, String.format("%s not found. Delegating to %s", USER_VALIDATION_MESSAGES,
                    DEFAULT_VALIDATION_MESSAGES));
        }
    }
    return rb;
}

From source file:com.l2jfree.mmocore.network.MMOLogger.java

@Override
public boolean isTraceEnabled() {
    return _logger.isLoggable(Level.FINEST);
}

From source file:es.csic.iiia.planes.behaviors.AbstractBehaviorAgent.java

private void handle(Behavior b, Message m) {
    final Class<? extends Behavior> bClass = b.getClass();
    final Class<? extends Message> mClass = m.getClass();

    // Memoize the method
    Method method;//w  w  w .  j  a  v  a 2s. c  o  m
    if (cache.containsKey(bClass, mClass)) {
        method = (Method) cache.get(bClass, mClass);
    } else {
        method = getMethod(bClass, mClass);
        if (method != null) {
            if (LOG.isLoggable(Level.FINEST)) {
                LOG.log(Level.FINEST, "Dispatching {0} to {1}",
                        new Object[] { mClass.getSimpleName(), method.toGenericString() });
            }
        }
        cache.put(bClass, mClass, method);
    }

    if (method == null) {
        return;
    }

    // Invoke it
    try {
        method.invoke(b, m);
    } catch (IllegalAccessException ex) {
        LOG.log(Level.SEVERE, null, ex);
    } catch (IllegalArgumentException ex) {
        LOG.log(Level.SEVERE, "Error invoking " + method.toGenericString() + " on " + b + " with argument " + m,
                ex);
    } catch (InvocationTargetException ex) {
        Throwable throwable = ex.getTargetException();
        if (throwable instanceof Error) {
            throw (Error) throwable;
        } else if (throwable instanceof RuntimeException) {
            throw (RuntimeException) throwable;
        }
        LOG.log(Level.SEVERE, null, throwable);
    }
}

From source file:org.gameontext.mediator.PlayerClient.java

/**
 * Get shared secret for player/*from  w w w  .  ja  v  a2s  . c  o  m*/
 * @param playerId
 * @param jwt
 * @param oldRoomId
 * @param newRoomId
 * @return
 */
public String getSharedSecret(String playerId, String jwt) {
    WebTarget target = this.root.path("{playerId}").resolveTemplate("playerId", playerId);

    Log.log(Level.FINER, this, "requesting shared secret using {0}", target.getUri().toString());

    try {
        // Make PUT request using the specified target, get result as a
        // string containing JSON
        Invocation.Builder builder = target.request(MediaType.APPLICATION_JSON);
        builder.header("Content-type", "application/json");
        builder.header("gameon-jwt", jwt);
        String result = builder.get(String.class);

        JsonReader p = Json.createReader(new StringReader(result));
        JsonObject j = p.readObject();
        JsonObject creds = j.getJsonObject("credentials");
        return creds.getString("sharedSecret");
    } catch (ResponseProcessingException rpe) {
        Response response = rpe.getResponse();
        Log.log(Level.FINER, this,
                "Exception obtaining shared secret for player,  uri: {0} resp code: {1} data: {2}",
                target.getUri().toString(),
                response.getStatusInfo().getStatusCode() + " " + response.getStatusInfo().getReasonPhrase(),
                response.readEntity(String.class));

        Log.log(Level.FINEST, this, "Exception obtaining shared secret for player", rpe);
    } catch (ProcessingException | WebApplicationException ex) {
        Log.log(Level.FINEST, this,
                "Exception obtaining shared secret for player (" + target.getUri().toString() + ")", ex);
    }

    // Sadly, badness happened while trying to get the shared secret
    return null;
}