Example usage for java.util.logging Level FINE

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

Introduction

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

Prototype

Level FINE

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

Click Source Link

Document

FINE is a message level providing tracing information.

Usage

From source file:de.themoep.ShowItem.ShowItem.java

public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if (sender.hasPermission("showitem.command")) {
        int radius = this.defaultradius;
        boolean showWorld = false;
        boolean showAll = false;
        Level debugLevel = Level.FINE;
        for (int i = 0; i < args.length; i++) {
            if (args[i].equalsIgnoreCase("-reload")) {
                if (sender.hasPermission("showitem.command.reload")) {
                    this.loadConfig();
                    sender.sendMessage(ChatColor.GREEN + "Config reloaded.");
                } else {
                    sender.sendMessage("You don't have the permission showitem.command.reload");
                }//from ww  w  .j  a v a  2s. c o m
                return true;
            } else if (args[i].equalsIgnoreCase("-debug")) {
                if (sender.hasPermission("showitem.command.debug")) {
                    debugLevel = Level.INFO;
                    sender.sendMessage(ChatColor.GREEN + "Debug message.");
                } else {
                    sender.sendMessage("You don't have the permission showitem.command.debug");
                    return true;
                }
            } else if (args[i].equalsIgnoreCase("-radius") || args[i].equalsIgnoreCase("-r")) {
                if (sender.hasPermission("showitem.command.radius")) {
                    i++;
                    try {
                        radius = Integer.parseInt(args[i]);
                    } catch (NumberFormatException e) {
                        sender.sendMessage(
                                ChatColor.RED + "Error: Your input " + args[i] + " is not a valid integer!");
                        return true;
                    } catch (IndexOutOfBoundsException e) {
                        sender.sendMessage(
                                ChatColor.RED + "Error: Please input a number after the radius argument!");
                        return true;
                    }
                } else {
                    sender.sendMessage("You don't have the permission showitem.command.radius");
                    return true;
                }
            } else if (args[i].equalsIgnoreCase("-world") || args[i].equalsIgnoreCase("-w")) {
                if (sender.hasPermission("showitem.command.world")) {
                    showWorld = true;
                } else {
                    sender.sendMessage("You don't have the permission showitem.command.world");
                    return true;
                }
            } else if (args[i].equalsIgnoreCase("-all") || args[i].equalsIgnoreCase("-a")) {
                if (sender.hasPermission("showitem.command.all")) {
                    showAll = true;
                } else {
                    sender.sendMessage("You don't have the permission showitem.command.all");
                    return true;
                }
            }
        }

        if (sender instanceof Player) {
            if (((Player) sender).getItemInHand().getType() == Material.AIR) {
                sender.sendMessage(getTranslation("error.noitem"));
            } else if (args.length > 0 && !args[0].startsWith("-")) {
                if (sender.hasPermission("showitem.command.player")) {
                    for (String name : args) {
                        if (!name.startsWith("-")) {
                            Player target = Bukkit.getPlayer(name);
                            if (target != null && target.isOnline()) {
                                showPlayer((Player) sender, target, debugLevel);
                            } else {
                                tellRaw((Player) sender,
                                        getTranslation("error.playeroffline", ImmutableMap.of("player", name)));
                            }
                        }
                    }
                } else {
                    sender.sendMessage("You don't have the permission showitem.command.player");
                }
            } else if (showAll) {
                showAll((Player) sender, debugLevel);
            } else if (showWorld) {
                showWorld((Player) sender, debugLevel);
            } else {
                showInRadius((Player) sender, radius, debugLevel);
            }
        } else {
            sender.sendMessage("This command can only be run by a player!");
        }
    } else {
        sender.sendMessage("You don't have the permission showitem.command");
    }
    return true;
}

From source file:hudson.cli.CLI.java

/**
 * @deprecated Specific to {@link Mode#REMOTING}.
 *///from w ww. jav a 2s  . c  om
@Deprecated
/*package*/ CLI(CLIConnectionFactory factory) throws IOException, InterruptedException {
    URL jenkins = factory.jenkins;
    this.httpsProxyTunnel = factory.httpsProxyTunnel;
    this.authorization = factory.authorization;
    ExecutorService exec = factory.exec;

    ownsPool = exec == null;
    pool = exec != null ? exec
            : Executors
                    .newCachedThreadPool(new NamingThreadFactory(Executors.defaultThreadFactory(), "CLI.pool"));

    Channel _channel;
    try {
        _channel = connectViaCliPort(jenkins, getCliTcpPort(jenkins));
    } catch (IOException e) {
        LOGGER.log(Level.FINE, "Failed to connect via CLI port. Falling back to HTTP", e);
        try {
            _channel = connectViaHttp(jenkins);
        } catch (IOException e2) {
            e.addSuppressed(e2);
            throw e;
        }
    }
    this.channel = _channel;

    // execute the command
    entryPoint = (CliEntryPoint) _channel.waitForRemoteProperty(CliEntryPoint.class.getName());

    if (entryPoint.protocolVersion() != CliEntryPoint.VERSION)
        throw new IOException(Messages.CLI_VersionMismatch());
}

From source file:com.jmstoolkit.beans.MessageTableModel.java

/**
 *
 * @param message/*from  www . jav a2s .  co  m*/
 */
@Override
public void onMessage(Message message) {
    LOGGER.log(Level.FINE, "Message Received");
    messagesReceived++;
    try {
        MessageTableRecord qRecord = new MessageTableRecord();
        qRecord.setJMSCorrelationID(message.getJMSCorrelationID());
        qRecord.setJMSDeliveryMode(message.getJMSDeliveryMode());
        qRecord.setJMSExpiration(message.getJMSExpiration());
        qRecord.setJMSMessageID(message.getJMSMessageID());
        qRecord.setJMSTimestamp(message.getJMSTimestamp());
        qRecord.setJMSType(message.getJMSType());
        qRecord.setJMSDestination(message.getJMSDestination());
        qRecord.setJMSCorrelationIDAsBytes(message.getJMSCorrelationIDAsBytes());
        qRecord.setJMSPriority(message.getJMSPriority());
        qRecord.setJMSType(message.getJMSType());
        qRecord.setJMSReplyTo(message.getJMSReplyTo());
        qRecord.setJMSRedelivered(message.getJMSRedelivered());
        Enumeration pEnumerator = message.getPropertyNames();
        Properties props = new Properties();
        while (pEnumerator.hasMoreElements()) {
            String pElement = (String) pEnumerator.nextElement();
            props.put(pElement, message.getStringProperty(pElement));
        }
        qRecord.setProperties(props);

        if (message instanceof TextMessage) {
            qRecord.setText(((TextMessage) message).getText());
        }
        if (message instanceof ObjectMessage) {
            qRecord.setObject(((ObjectMessage) message).getObject());
        }

        List newData = data;
        newData.add(qRecord);
        this.setData(newData);
    } catch (JMSException e) {
        LOGGER.log(Level.WARNING, "JMS problem", e);
    }
}

From source file:org.tomitribe.tribestream.registryng.repository.Repository.java

public OpenApiDocument findApplicationFromHumanReadableMetadata(final String humanReadableApplicationName,
        final String version) {
    try {/*from   w  ww.j  ava 2 s .co  m*/
        final List<OpenApiDocument> openApiDocuments = ofNullable(version).filter(v -> !v.trim().isEmpty())
                .map(v -> em.createNamedQuery(OpenApiDocument.Queries.FIND_BY_HUMAN_REDABLE_NAME,
                        OpenApiDocument.class).setParameter("applicationVersion", version))
                .orElseGet(() -> em.createNamedQuery(
                        OpenApiDocument.Queries.FIND_BY_HUMAN_REDABLE_NAME_NO_VERSION, OpenApiDocument.class))
                .setParameter("applicationName", humanReadableApplicationName).setMaxResults(2).getResultList();
        if (openApiDocuments.size() > 1) {
            throw new IllegalArgumentException("Conflicting documents: " + openApiDocuments);
        }
        if (openApiDocuments.isEmpty()) {
            return null;
        }
        return openApiDocuments.get(0);
    } catch (final NoResultException e) {
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, "Could not find endpoint by {0}", humanReadableApplicationName);
        }
        return null;
    }
}

From source file:alien4cloud.paas.cloudify2.rest.external.RestClientExecutor.java

/**
 *
 * @param relativeUrl/*from   ww  w.  j  a v a 2 s.  com*/
 *            The URL to post to.
 * @param fileToPost
 *            The file to post.
 * @param partName
 *            The name of the request parameter (the posted file) to bind to.
 * @param responseTypeReference
 *            The type reference of the response.
 * @param <T> The type of the response.
 * @return The response object from the REST server.
 * @throws RestClientException
 *             Reporting failure to post the file.
 */
public <T> T postFile(final String relativeUrl, final File fileToPost, final String partName,
        final TypeReference<Response<T>> responseTypeReference) throws RestClientException {
    final MultipartEntity multipartEntity = new MultipartEntity();
    final FileBody fileBody = new FileBody(fileToPost);
    multipartEntity.addPart(partName, fileBody);
    if (logger.isLoggable(Level.FINE)) {
        logger.log(Level.FINE,
                "executing post request to " + relativeUrl + ", tring to post file " + fileToPost.getName());
    }
    return post(relativeUrl, responseTypeReference, multipartEntity);
}

From source file:eu.edisonproject.training.wsd.DisambiguatorImpl.java

@Override
public void configure(Properties properties) {
    String numOfTerms = System.getProperty("num.of.terms");

    if (numOfTerms == null) {
        limit = Integer.valueOf(properties.getProperty("num.of.terms", "5"));
    } else {//from  www  .  j a va 2 s  .c  o  m
        limit = Integer.valueOf(numOfTerms);
    }
    LOGGER.log(Level.FINE, "num.of.terms: {0}", limit);

    String offset = System.getProperty("offset.terms");

    if (offset == null) {
        lineOffset = Integer.valueOf(properties.getProperty("offset.terms", "1"));
    } else {
        lineOffset = Integer.valueOf(offset);
    }
    LOGGER.log(Level.FINE, "offset.terms: {0}", lineOffset);
    String minimumSimilarityStr = System.getProperty("minimum.similarity");
    if (minimumSimilarityStr == null) {
        minimumSimilarityStr = properties.getProperty("minimum.similarity", "0,3");
    }
    minimumSimilarity = Double.valueOf(minimumSimilarityStr);
    LOGGER.log(Level.FINE, "minimum.similarity: {0}", lineOffset);
    stopWordsPath = System.getProperty("stop.words.file");

    if (stopWordsPath == null) {
        stopWordsPath = properties.getProperty("stop.words.file",
                ".." + File.separator + "etc" + File.separator + "stopwords.csv");
    }
    LOGGER.log(Level.FINE, "stop.words.file: {0}", stopWordsPath);
    itemsFilePath = System.getProperty("itemset.file");
    if (itemsFilePath == null) {
        itemsFilePath = properties.getProperty("itemset.file",
                ".." + File.separator + "etc" + File.separator + "allTerms.csv");
    }
    LOGGER.log(Level.FINE, "itemset.file: {0}", itemsFilePath);
    //        Configuration config = HBaseConfiguration.create();
    //        try {
    //            conn = ConnectionFactory.createConnection(config);
    //        } catch (IOException ex) {
    //            LOGGER.log(Level.SEVERE, null, ex);
    //        }
    CharArraySet stopwordsCharArray = new CharArraySet(ConfigHelper.loadStopWords(stopWordsPath), true);
    tokenizer = new StopWord(stopwordsCharArray);
    lematizer = new StanfordLemmatizer();
    stemer = new Stemming();

    //        try {
    //            String logPropFile = properties.getProperty("logging.properties.file", ".." + File.separator + "etc" + File.separator + "log.properties");
    //            FileInputStream fis = new FileInputStream(logPropFile);
    //            LogManager.getLogManager().readConfiguration(fis);
    //        } catch (FileNotFoundException ex) {
    //            Logger.getLogger(DisambiguatorImpl.class.getName()).log(Level.WARNING, null, ex);
    //        } catch (IOException | SecurityException ex) {
    //            Logger.getLogger(DisambiguatorImpl.class.getName()).log(Level.WARNING, null, ex);
    //        }
    Level level = Level.parse(properties.getProperty("log.level", "INFO"));

    Handler[] handlers = Logger.getLogger("").getHandlers();
    for (int index = 0; index < handlers.length; index++) {
        handlers[index].setLevel(level);
    }
    LOGGER.setLevel(level);
}

From source file:com.elasticgrid.storage.rackspace.CloudFilesContainer.java

public Storable uploadStorable(String name, InputStream stream, String mimeType) throws StorageException {
    try {//w  ww  .j  a v  a 2  s  .co m
        rackspace.login();
        // create directories if needed
        String path = name.substring(0, name.lastIndexOf('/'));
        logger.log(Level.FINE, "Creating full path \"{0}\"", path);
        rackspace.createFullPath(getName(), path);
        // upload the file
        logger.log(Level.FINE, "Uploading \"{0}\"", name);
        try {
            rackspace.storeStreamedObject(getName(), stream, mimeType, name,
                    Collections.<String, String>emptyMap());
        } finally {
            IOUtils.closeQuietly(stream);
        }
        // retrieve rackspace object
        return findStorableByName(name);
    } catch (Exception e) {
        throw new StorageException("Can't upload storable from stream", e);
    }
}

From source file:com.googlecode.jgenhtml.JGenHtmlUtils.java

/**
 * Writes a resource (e.g. CSS file) to the destination directory.
 * @param resourceName The name of a resource (which the classloader can find).
 * @param destDir The destination directory.
 *//*from w  ww. j a  v a 2s  . com*/
protected static void writeResource(final File resource, final File destDir) {
    try {
        LOGGER.log(Level.FINE, "Copying resource {0}", resource.getName());
        FileUtils.copyFileToDirectory(resource, destDir);
    } catch (IOException ex) {
        LOGGER.log(Level.SEVERE, ex.getLocalizedMessage());
    }
}

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

/**
 * Logs a message **before** sending the reply message.
 * /* w  ww . j  av a 2s.c o  m*/
 * @param logger
 *            The logger.
 * @param logMTask
 *            The logAndMessage task.
 * @param messenger
 *            The messenger that will send the message after logging.
 * @throws JSONException
 * @throws IOException
 */
protected static final void logAndMessage(AbstractPaxosLogger logger, LogMessagingTask logMTask// , Messenger<?> messenger
) throws JSONException, IOException {
    // don't accept new work if about to close
    if (logger.isAboutToClose())
        return;
    assert (logMTask != null);
    // if no log message, just send right away
    if (logMTask.logMsg == null) {
        logger.messenger.send(logMTask);
        return;
    }
    // else spawn a log-and-message task
    PaxosPacket packet = logMTask.logMsg;
    log.log(Level.FINE, "{0}{1}{2}{3}{4}{5}", new Object[] { "Node ", logger.myID, " logging ",
            (packet.getType()), ": ", packet.getSummary(log.isLoggable(Level.FINE)) });
    assert (packet.getPaxosID() != null) : ("Null paxosID in " + packet);
    logger.batchLogger.enqueue(logMTask); // batchLogger will also send
}

From source file:fr.logfiletoes.TailerListenerUnit.java

public void saveToElasticsearch() {
    HttpPost elasticSearchPost = new HttpPost(
            unit.getElasticSearch().getUrl() + "/" + unit.getElasticSearch().getType());
    try {// ww  w. ja v  a2  s  .  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);
    }
}