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.jackwhite20.japs.server.network.Connection.java

@Override
protected void channelRead0(ChannelHandlerContext ctx, JSONObject jsonObject) throws Exception {

    if (jsonObject.isNull("op")) {
        return;/*from  w ww. j  a  va 2  s. com*/
    }

    int op = ((Integer) jsonObject.remove("op"));

    OpCode opCode = OpCode.of(op);

    switch (opCode) {
    case OP_BROADCAST:
        if (!jsonObject.has("su")) {
            // Broadcast it to all subscriber
            server.broadcast(this, jsonObject.getString("ch"), jsonObject);
        } else {
            // Broadcast to specific subscriber
            server.broadcastTo(this, jsonObject.getString("ch"), jsonObject, jsonObject.getString("su"));
        }
        break;
    case OP_CACHE_GET:
        String getKey = jsonObject.getString("key");
        int getCallbackId = jsonObject.getInt("id");

        Object getValue = server.cache().get(getKey);

        JSONObject getResponse = new JSONObject().put("op", 5).put("id", getCallbackId).put("value", getValue);

        send(getResponse);

        LOGGER.log(Level.FINE, "[{0}] Got cache entry {1}={2} and a callback id of {3}",
                new Object[] { remoteAddress.toString(), getKey, getValue, getCallbackId });
        break;
    case OP_CACHE_ADD:
        String key = jsonObject.getString("key");
        Object value = jsonObject.get("value");
        int expire = jsonObject.getInt("expire");

        server.cache().put(key, value, expire);

        server.clusterBroadcast(this, jsonObject.put("op", OpCode.OP_CACHE_ADD.getCode()));

        LOGGER.log(Level.FINE, "[{0}] Added cache entry {1}={2} with an expire of {3}",
                new Object[] { remoteAddress.toString(), key, value, expire });
        break;
    case OP_CACHE_REMOVE:
        String removeKey = jsonObject.getString("key");

        server.cache().remove(removeKey);

        server.clusterBroadcast(this, jsonObject.put("op", OpCode.OP_CACHE_REMOVE.getCode()));

        LOGGER.log(Level.FINE, "[{0}] Removed cache entry with key {1}",
                new Object[] { remoteAddress.toString(), removeKey });
        break;
    case OP_CACHE_HAS:
        boolean has = server.cache().has(jsonObject.getString("key"));

        JSONObject hasResponse = new JSONObject().put("op", OpCode.OP_CACHE_HAS.getCode())
                .put("id", jsonObject.getInt("id")).put("has", has);

        send(hasResponse);
        break;
    case OP_CACHE_SET_EXPIRE:
        String expireKey = jsonObject.getString("key");
        int expireSeconds = jsonObject.getInt("expire");

        server.cache().expire(expireKey, expireSeconds);

        server.clusterBroadcast(this, jsonObject.put("op", OpCode.OP_CACHE_SET_EXPIRE.getCode()));

        LOGGER.log(Level.FINE, "[{0}] Set expire seconds for key {1} to {2} seconds",
                new Object[] { remoteAddress.toString(), expireKey, expireSeconds });
        break;
    case OP_CACHE_GET_EXPIRE:
        String expireGetKey = jsonObject.getString("key");
        int expireGetCallbackId = jsonObject.getInt("id");

        int expireGetValue = ((int) server.cache().expire(expireGetKey));

        JSONObject expireGetResponse = new JSONObject().put("op", 5).put("id", expireGetCallbackId).put("value",
                expireGetValue);

        send(expireGetResponse);

        LOGGER.log(Level.FINE, "[{0}] Got expire in time for key {1} which will expire in {2} seconds",
                new Object[] { remoteAddress.toString(), expireGetKey, expireGetValue });
        break;
    case OP_REGISTER_CHANNEL:
        String channelToRegister = jsonObject.getString("ch");

        server.subscribeChannel(channelToRegister, this);
        channels.add(channelToRegister);
        break;
    case OP_UNREGISTER_CHANNEL:
        String channelToRemove = jsonObject.getString("ch");

        server.unsubscribeChannel(channelToRemove, this);
        channels.remove(channelToRemove);
        break;
    case OP_SUBSCRIBER_SET_NAME:
        name = jsonObject.getString("su");

        LOGGER.log(Level.FINE, "[{0}] Subscriber name set to: {1}",
                new Object[] { remoteAddress.toString(), name });
        break;
    case OP_CLUSTER_INFO_SET:
        host = jsonObject.getString("host");
        port = jsonObject.getInt("port");

        LOGGER.log(Level.FINE, "[{0}] Cluster info set to: {1}:{2}",
                new Object[] { remoteAddress.toString(), host, String.valueOf(port) });
        break;
    case OP_KEEP_ALIVE:
        // Ignore for now
        //LOGGER.log(Level.FINE, "[{0}] Keep alive time: {1}", new Object[]{remoteAddress.toString(), System.currentTimeMillis()});
        break;
    case OP_UNKNOWN:
        LOGGER.log(Level.WARNING, "[{0}] Unknown OP code received: {0}",
                new Object[] { remoteAddress.toString(), op });
        break;
    }
}

From source file:di.uniba.it.tee2.wiki.Wikidump2Index.java

private void build(File xmlDump, String language) throws Exception {
    try {//  ww w .  ja  va2 s .com
        WikipediaDumpIterator wikiIterator = new WikipediaDumpIterator(xmlDump, encoding);
        PageCleaner cleaner = PageCleanerWrapper.getInstance(language);
        int counter = 0;
        Integer docID = 0;
        while (wikiIterator.hasNext() && docID < pageLimit) {
            WikiPage wikiPage = wikiIterator.next();
            ParsedPage parsedPage = wikiPage.getParsedPage();
            String title = wikiPage.getTitle();
            if (!title.matches(notValidTitle)) {
                if (parsedPage != null) {
                    String text = cleaner.clean(parsedPage.getText());
                    logger.log(Level.FINE, "Process doc {0}", title);
                    if (text.length() > this.minTextLegth) {
                        try {
                            tee.add(title, text, title, docID.toString(), wikiPage.getWikiID(),
                                    wikiPage.getRevisionID());
                            docID++;
                            if (docID % 100 == 0) {
                                logger.log(Level.INFO, "Indexed pages: {0}", docID);
                            }
                        } catch (Exception ex) {
                            logger.log(Level.SEVERE, "Error to index page (skip page) " + title, ex);
                        }
                    }
                }
                counter++;
            }
        }

        logger.log(Level.INFO, "Extracted pages: {0}", counter);
        logger.log(Level.INFO, "Indexed pages: {0}", docID);
        wikiIterator.close();
        tee.close();

    } catch (XMLStreamException | FileNotFoundException | CompressorException ex) {
        logger.log(Level.SEVERE, "Error to build index", ex);
    }

}

From source file:com.marvelution.hudson.plugins.apiv2.APIv2Plugin.java

/**
 * {@inheritDoc}//from  www .j  a  v  a2s  .  co  m
 */
public void start() throws Exception {
    plugin = this;
    load();
    LOGGER.log(Level.FINE, "Adding the APIv2 Filters");
    filters.add(new HudsonAPIV2ServletFilter());
    for (Filter filter : filters) {
        PluginServletFilter.addFilter(filter);
    }
    LOGGER.log(Level.FINE, "Loading the Activity Cache");
    File activityCacheFile = getFile(ACTIVITIES_CACHE_FILE);
    if (activityCacheFile.exists()) {
        try {
            activitiesCache = (ActivitiesCache) XSTREAM.fromXML(new FileInputStream(activityCacheFile));
        } catch (Exception e) {
            LOGGER.severe(
                    "Failed to load the activity-cache.xml and will thus not be available for the REST APIs");
        }
    }
    LOGGER.log(Level.FINE, "Loading the Issues Cache");
    File issuesCacheFile = getFile(ISSUES_CACHE_FILE);
    if (issuesCacheFile.exists()) {
        try {
            issuesCache = (IssuesCache) XSTREAM.fromXML(new FileInputStream(issuesCacheFile));
        } catch (Exception e) {
            LOGGER.severe(
                    "Failed to load the issue-cache.xml and will thus not be available for the REST APIs");
        }
    }
    if (StringUtils.isBlank(issuesCache.getIssueKeyRegex())) {
        // Make sure the pattern is set
        issuesCache.setIssueKeyRegex(JiraKeyUtils.DEFAULT_JIRA_ISSUE_KEY_PATTERN.pattern());
    }
}

From source file:es.prodevelop.gvsig.mini.tasks.yours.YOURSFunctionality.java

@Override
public boolean execute() {
    try {/*from  w  w  w.j ava  2s.c  o  m*/
        final Point ini = (Point) route.getStartPoint().clone();
        final Point end = (Point) route.getEndPoint().clone();

        final String routeString = route.toYOURS(ini, end);

        log.log(Level.FINE, routeString);

        /* Define the URL we want to load data from. */
        URL parseURL = new URL(routeString);
        /* Open a connection to that URL. */
        if (this.isCanceled()) {
            res = TaskHandler.CANCELED;
            return true;
        }
        URLConnection urlconnec = parseURL.openConnection();

        urlconnec.setRequestProperty("X-Yours-client", "gvSIG");
        urlconnec.setReadTimeout(30000);
        /* Define InputStreams to read from the URLConnection. */
        InputStream is = urlconnec.getInputStream();
        BufferedInputStream bis = new BufferedInputStream(is);

        /*
         * Read bytes to the Buffer until there is nothing more to read(-1).
         */
        ByteArrayBuffer baf = new ByteArrayBuffer(50);
        int current = 0;
        while ((current = bis.read()) != -1) {
            if (isCanceled()) {
                res = TaskHandler.CANCELED;
                return true;
            }
            baf.append((byte) current);
        }

        res = route.fromYOURS(baf.toByteArray());
    } catch (IOException e) {
        res = TaskHandler.NO_RESPONSE;
    } catch (Exception e) {
        res = TaskHandler.ERROR;
        log.log(Level.SEVERE, "", e);
    } finally {
        // handler.sendEmptyMessage(map.ROUTE_SUCCEEDED);

        try {
            // if (res == -1) {
            // handler.sendEmptyMessage(map.ROUTE_CANCELED);
            if (res == -2) {
                res = TaskHandler.NO_RESPONSE;
            } else if (res == -3) {
                res = TaskHandler.BAD_RESPONSE;
            } else if (res == 1) {
                res = TaskHandler.FINISHED;
                if (route.getState() == Tags.ROUTE_WITH_START_AND_PASS_POINT) {
                    route.setState(Tags.ROUTE_WITH_N_POINT);
                } else if (route.getState() == Tags.ROUTE_WITH_START_POINT) {
                    route.setState(Tags.ROUTE_WITH_2_POINT);
                }
            }
        } catch (Exception e) {
            log.log(Level.SEVERE, "", e);
        } finally {
            // super.stop();
        }
        return true;
    }

}

From source file:de.crowdcode.kissmda.core.uml.UmlHelper.java

public void log(Object o, String logMsg) {
    logger.log(Level.FINE, logMsg + ": " + o != null ? o.toString() : "<null>");
}

From source file:org.cloudfoundry.reconfiguration.tomee.DelegatingPropertiesProvider.java

private String extractCloudFoundryServiceId() {
    String cfServiceId = removeContextRootFromServiceId();
    cfServiceId = removeServicePrefix(cfServiceId);

    if (logger.isLoggable(Level.FINE)) {
        logger.fine("Extracted serviceId \"" + cfServiceId + "\" from " + "+\"" + serviceId + "\"");
    }/*from  w w  w  .  j a v a 2s.c om*/

    return cfServiceId;
}

From source file:net.chrissearle.flickrvote.dao.JpaChallengeDao.java

/**
 * Method getVotingChallenge returns the current voting challenge. Null if none found.
 *
 * @return the current voting challenge.
 *///from   w ww.  ja v a  2 s  . com
@SuppressWarnings("unchecked")
public Challenge getVotingChallenge() {
    Query query = entityManager
            .createQuery("select c from Challenge c where c.votingOpenDate <= :now and c.endDate > :now");
    query.setParameter("now", new Date());

    List<Challenge> challenges = (List<Challenge>) query.getResultList();

    if (logger.isLoggable(Level.FINE)) {
        logger.fine("Voting challenges: " + challenges);
    }

    if (challenges.size() > 0) {
        return challenges.iterator().next();
    }

    return null;
}

From source file:org.geoserver.wps.resource.WPSResourceManager.java

/**
 * Create a new unique id for the process. All resources linked to the process should use this
 * token to register themselves against the manager
 * //from  w  ww .java2s  .  co m
 * @return
 */
public String getExecutionId(Boolean synch) {
    String id = executionId.get();
    if (id == null) {
        id = UUID.randomUUID().toString();
        executionId.set(id);
        resourceCache.put(id, new ExecutionResources(synch != null ? synch : true));
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, "Associating process with execution id: " + id);
        }
    }
    return id;
}

From source file:com.izforge.izpack.uninstaller.resource.RootScripts.java

/**
 * Removes the given files as root for the given Users
 *
 * @param script The Script to exec at uninstall time by root.
 *//*from w  w w .j a  v  a  2  s  .  c  o  m*/
protected void run(String script) {
    try {
        boolean enabled = logger.isLoggable(Level.FINE);
        if (enabled) {
            logger.fine("Executing script: " + script);
        }

        File file = File.createTempFile("izpackrootscript", ".sh");

        String result = ShellScript.execAndDelete(new StringBuffer(script), file.getPath());
        if (enabled) {
            logger.fine("Result: " + result);
        }
    } catch (Exception exception) {
        logger.log(Level.WARNING, "Failed to execute script: " + exception.getMessage(), exception);
    }
}

From source file:de.crowdcode.kissmda.core.uml.PackageHelper.java

/**
 * Get full package name, remove sourceDirectoryPackageName and change :: to
 * dot.//from w ww  . j a va  2 s.  com
 * 
 * @param umlPackageNameWithClass
 *            UML2 package name with classifier as String
 * @param sourceDirectoryPackageName
 *            from the stereotype
 * @return full package name
 */
public String getFullPackageName(String umlPackageNameWithClass, String sourceDirectoryPackageName) {
    // Get package until the beginning of SourceDirectory
    logger.log(Level.FINE, "Qualified name: " + umlPackageNameWithClass);
    // Remove UML prefixes
    String packageName = removeUmlPrefixes(umlPackageNameWithClass);
    // Remove the sourceDirectoryPackageName
    String toBeDeleted = sourceDirectoryPackageName + "::";
    String fullPackageName = packageName.replace(toBeDeleted, "");
    // Change :: to .
    fullPackageName = fullPackageName.replaceAll("::", ".");
    logger.log(Level.FINE, "Real package name: " + fullPackageName);
    return fullPackageName;
}