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:com.l2jfree.mmocore.network.MMOLogger.java

@Override
public void debug(Object message) {
    log(Level.FINE, String.valueOf(message), null);
}

From source file:de.crowdcode.kissmda.cartridges.simplejava.InterfaceGenerator.java

/**
 * Generate the Getters and Setters methods.
 * //from  w  w w . j a va 2  s  .c o m
 * @param clazz
 *            the UML class
 * @param ast
 *            the JDT Java AST
 * @param td
 *            TypeDeclaration Java JDT
 */
public void generateGettersSetters(Classifier clazz, AST ast, TypeDeclaration td) {
    // Create getter and setter for all attributes
    // Without inheritance
    EList<Property> properties = clazz.getAttributes();
    for (Property property : properties) {
        // Create getter for each property
        // Return type?
        Type type = property.getType();
        logger.log(Level.FINE, "Class: " + clazz.getName() + " - " + "Property: " + property.getName() + " - "
                + "Property Upper: " + property.getUpper() + " - " + "Property Lower: " + property.getLower());
        String umlTypeName = type.getName();
        String umlQualifiedTypeName = type.getQualifiedName();

        // Only for parameterized type
        if (dataTypeUtils.isParameterizedType(umlTypeName)) {
            Map<String, String> types = umlHelper.checkParameterizedTypeForTemplateParameterSubstitution(type);
            umlTypeName = types.get("umlTypeName");
            umlQualifiedTypeName = types.get("umlQualifiedTypeName");
        }

        // Check the property name, no content means we have to get the
        // "type" and use it as the name
        if (property.getName().equals("")) {
            Type targetType = property.getType();
            String newPropertyName = "";
            if (property.getUpper() >= 0) {
                // Upper Cardinality 0..1
                newPropertyName = targetType.getName();
            } else {
                // Upper Cardinality 0..*
                newPropertyName = methodHelper.getPluralName(targetType.getName());
            }
            property.setName(StringUtils.uncapitalize(newPropertyName));
        }

        // Create getter for each property
        generateGetterMethod(ast, td, property, umlTypeName, umlQualifiedTypeName);

        if (!property.isReadOnly()) {
            // Create setter method for each property
            generateSetterMethod(ast, td, property, umlTypeName, umlQualifiedTypeName);
        }
    }
}

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

/**
 * Parses a gcov tracefile.//www  .  j ava  2s. c o m
 * @param traceFile A gcov tracefile.
 * @param isDescFile true if this is a descriptions (.desc) file.
 * @param isBaseFile true if this is a baseline file.
 */
private void parseDatFile(final File traceFile, final boolean isDescFile, final boolean isBaseFile)
        throws IOException, ParserConfigurationException {
    //I used the info from here: http://manpages.ubuntu.com/manpages/precise/man1/geninfo.1.html
    File fileToProcess;
    if (traceFile.getName().endsWith(".gz")) {
        LOGGER.log(Level.FINE, "File {0} ends with .gz, going to gunzip it.", traceFile.getName());
        fileToProcess = JGenHtmlUtils.gunzip(traceFile);
    } else {
        fileToProcess = traceFile;
    }
    LineIterator iterator = FileUtils.lineIterator(fileToProcess);
    try {
        TestCaseSourceFile testCaseSourceFile = null;
        String testCaseName = DEFAULT_TEST_NAME;
        while (iterator.hasNext()) {
            String line = iterator.nextLine();
            int tokenIdx = line.indexOf("SF:");
            if (tokenIdx >= 0 || (tokenIdx = line.indexOf("KF:")) >= 0) {
                String fullPath = line.substring(line.indexOf(tokenIdx) + 4);
                File sourceFile = new File(fullPath);
                fullPath = sourceFile.getCanonicalPath();
                testCaseSourceFile = parsedFiles.get(fullPath);
                if (!isBaseFile && testCaseSourceFile == null) {
                    testCaseSourceFile = new TestCaseSourceFile(testTitle, sourceFile.getName());
                    testCaseSourceFile.setSourceFile(sourceFile);
                    parsedFiles.put(fullPath, testCaseSourceFile);
                }
            } else if (line.indexOf("end_of_record") >= 0) {
                if (testCaseSourceFile != null) {
                    testCaseName = DEFAULT_TEST_NAME;
                    testCaseSourceFile = null;
                } else {
                    LOGGER.log(Level.FINE, "Unexpected end of record");
                }
            } else if (testCaseSourceFile != null) {
                testCaseSourceFile.processLine(testCaseName, line, isBaseFile);
            } else {
                if (isDescFile) {
                    descriptionsPage.addLine(line);
                } else if (line.startsWith("TN:")) {
                    String[] data = JGenHtmlUtils.extractLineValues(line);
                    testCaseName = data[0].trim();
                    if (testCaseName.length() > 0) {
                        if (runTestNames == null) {
                            runTestNames = new HashSet<String>();
                        }
                        runTestNames.add(testCaseName);
                    }
                } else {
                    LOGGER.log(Level.FINE, "Unexpected line: {0}", line);
                }
            }
        }
    } finally {
        LineIterator.closeQuietly(iterator);
    }
}

From source file:com.cyberway.issue.crawler.fetcher.FetchDNS.java

protected void innerProcess(CrawlURI curi) {
    if (!curi.getUURI().getScheme().equals("dns")) {
        // Only handles dns
        return;//from  w  ww .  j ava2s  .  com
    }
    Record[] rrecordSet = null; // Retrieved dns records
    String dnsName = null;
    try {
        dnsName = curi.getUURI().getReferencedHost();
    } catch (URIException e) {
        logger.log(Level.SEVERE, "Failed parse of dns record " + curi, e);
    }

    if (dnsName == null) {
        curi.setFetchStatus(S_UNFETCHABLE_URI);
        return;
    }

    // Make sure we're in "normal operating mode", e.g. a cache +
    // controller exist to assist us.
    CrawlHost targetHost = null;
    if (getController() != null && getController().getServerCache() != null) {
        targetHost = getController().getServerCache().getHostFor(dnsName);
    } else {
        // Standalone operation (mostly for test cases/potential other uses)
        targetHost = new CrawlHost(dnsName);
    }
    if (isQuadAddress(curi, dnsName, targetHost)) {
        // We're done processing.
        return;
    }

    // Do actual DNS lookup.
    curi.putLong(A_FETCH_BEGAN_TIME, System.currentTimeMillis());

    // Try to get the records for this host (assume domain name)
    // TODO: Bug #935119 concerns potential hang here
    try {
        rrecordSet = (new Lookup(dnsName, TypeType, ClassType)).run();
    } catch (TextParseException e) {
        rrecordSet = null;
    }
    curi.setContentType("text/dns");
    if (rrecordSet != null) {
        if (logger.isLoggable(Level.FINE)) {
            logger.fine("Found recordset for " + dnsName);
        }
        storeDNSRecord(curi, dnsName, targetHost, rrecordSet);
    } else {
        if (logger.isLoggable(Level.FINE)) {
            logger.fine("Failed find of recordset for " + dnsName);
        }
        if (((Boolean) getUncheckedAttribute(null, ATTR_ACCEPT_NON_DNS_RESOLVES)).booleanValue()) {
            // Do lookup that bypasses javadns.
            InetAddress address = null;
            try {
                address = InetAddress.getByName(dnsName);
            } catch (UnknownHostException e1) {
                address = null;
            }
            if (address != null) {
                targetHost.setIP(address, DEFAULT_TTL_FOR_NON_DNS_RESOLVES);
                curi.setFetchStatus(S_GETBYNAME_SUCCESS);
                if (logger.isLoggable(Level.FINE)) {
                    logger.fine("Found address for " + dnsName + " using native dns.");
                }
            } else {
                if (logger.isLoggable(Level.FINE)) {
                    logger.fine("Failed find of address for " + dnsName + " using native dns.");
                }
                setUnresolvable(curi, targetHost);
            }
        } else {
            setUnresolvable(curi, targetHost);
        }
    }
    curi.putLong(A_FETCH_COMPLETED_TIME, System.currentTimeMillis());
}

From source file:javancss.Javancss.java

private void _measureSource(Reader reader) throws Exception, Error {
    log.fine("_measureSource(Reader).ENTER");

    try {// w  w w.j a v  a 2 s. c o m
        // create a parser object
        if (log.isLoggable(Level.FINE)) {
            log.fine("creating JavaParserDebug");
            _pJavaParser = new JavaParserDebug(reader);
        } else {
            log.fine("creating JavaParser");
            _pJavaParser = new JavaParser(reader);
        }

        // execute the parser
        _pJavaParser.parse();
        log.fine("Javancss._measureSource(DataInputStream).SUCCESSFULLY_PARSED");

        _ncss += _pJavaParser.getNcss(); // increment the ncss
        _loc += _pJavaParser.getLOC(); // and loc
        // add new data to global vector
        _vFunctionMetrics.addAll(_pJavaParser.getFunction());
        _vObjectMetrics.addAll(_pJavaParser.getObject());
        Map<String, PackageMetric> htNewPackages = _pJavaParser.getPackage();

        /* List vNewPackages = new Vector(); */
        for (Map.Entry<String, PackageMetric> entry : htNewPackages.entrySet()) {
            String sPackage = entry.getKey();

            PackageMetric pckmNext = htNewPackages.get(sPackage);
            pckmNext.name = sPackage;

            PackageMetric pckmPrevious = _htPackages.get(sPackage);
            pckmNext.add(pckmPrevious);

            _htPackages.put(sPackage, pckmNext);
        }
    } catch (Exception pParseException) {
        if (_sErrorMessage == null) {
            _sErrorMessage = "";
        }
        _sErrorMessage += "ParseException in STDIN";
        if (_pJavaParser != null) {
            _sErrorMessage += "\nLast useful checkpoint: \"" + _pJavaParser.getLastFunction() + "\"\n";
        }
        _sErrorMessage += pParseException.getMessage() + "\n";
        _thrwError = pParseException;

        throw pParseException;
    } catch (Error pTokenMgrError) {
        if (_sErrorMessage == null) {
            _sErrorMessage = "";
        }
        _sErrorMessage += "TokenMgrError in STDIN\n";
        _sErrorMessage += pTokenMgrError.getMessage() + "\n";
        _thrwError = pTokenMgrError;

        throw pTokenMgrError;
    }
}

From source file:org.muhia.app.psi.config.http.CustomHttpClientUtilities.java

public String doGetWithResponseHandler(String url, String[] replaceParams, String[] params) {
    String result;/*from ww  w .j av a 2s.c  o  m*/
    // CloseableHttpResponse response = null;
    CloseableHttpClient client = null;
    try {
        if (replaceParams.length > 0) {
            for (int i = 0; i < replaceParams.length; i++) {
                Logger.getLogger(CustomHttpClientUtilities.class.getName()).log(Level.FINE, replaceParams[i],
                        params[i]);
                url = url.replaceAll(replaceParams[i], params[i]);
            }
        }

        RequestConfig config = RequestConfig.custom().setConnectTimeout(hcp.getConnectionTimeout())
                .setConnectionRequestTimeout(hcp.getConnectionRequestTimeout())
                .setSocketTimeout(hcp.getSockectTimeout()).build();

        client = HttpClientBuilder.create().setDefaultRequestConfig(config).build();

        HttpGet getMethod = new HttpGet(url);

        ResponseHandler<String> responseHandler = (final HttpResponse response) -> {
            int status = response.getStatusLine().getStatusCode();
            if (status >= hcp.getLowerStatusLimit() && status <= hcp.getUpperStatusLimit()) {
                HttpEntity entity = response.getEntity();
                return entity != null ? EntityUtils.toString(entity) : null;
            } else {
                throw new ClientProtocolException(hcp.getExceptionMessage() + status);
            }
        };

        result = client.execute(getMethod, responseHandler);
        client.close();

    } catch (SocketTimeoutException ex) {
        result = hcp.getTimeoutMessage();
        Logger.getLogger(CustomHttpClientUtilities.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        result = hcp.getFailMessage();
        Logger.getLogger(CustomHttpClientUtilities.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
        try {
            if (client != null) {
                client.close();
            }

        } catch (IOException ex) {
            Logger.getLogger(CustomHttpClientUtilities.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    return result;
}

From source file:com.cloudbees.hudson.plugins.folder.computed.FolderComputation.java

/**
 * {@inheritDoc}/*from   ww w  . j  a  v  a  2 s .  co  m*/
 */
@Override
public void run() {
    StreamBuildListener listener;
    try {
        File logFile = getLogFile();
        FileUtils.forceMkdir(logFile.getParentFile());
        OutputStream os;
        if (BACKUP_LOG_COUNT != null) {
            os = new ReopenableRotatingFileOutputStream(logFile, BACKUP_LOG_COUNT);
            ((ReopenableRotatingFileOutputStream) os).rewind();
        } else {
            os = new FileOutputStream(logFile);
        }
        listener = new StreamBuildListener(os, Charsets.UTF_8);
    } catch (IOException x) {
        LOGGER.log(Level.WARNING, null, x);
        result = Result.FAILURE;
        return;
    }
    timestamp = System.currentTimeMillis();
    // TODO print start time
    listener.started(getCauses());
    Result _result = Result.NOT_BUILT; // cf. isLogUpdated, do not set this.result until listener closed
    try {
        folder.updateChildren(listener);
        _result = Result.SUCCESS;
    } catch (InterruptedException x) {
        LOGGER.log(Level.FINE, "recomputation of " + folder.getFullName() + " was aborted", x);
        listener.getLogger().println("Aborted");
        _result = Result.ABORTED;
    } catch (Exception x) {
        LOGGER.log(Level.FINE, "recomputation of " + folder.getFullName() + " failed", x);
        if (x instanceof AbortException) {
            listener.fatalError(x.getMessage());
        } else {
            x.printStackTrace(
                    listener.fatalError("Failed to recompute children of " + folder.getFullDisplayName()));
        }
        _result = Result.FAILURE;
    } finally {
        duration = System.currentTimeMillis() - timestamp;
        if (durations == null) {
            durations = new ArrayList<Long>();
        }
        while (durations.size() > 32) {
            durations.remove(0);
        }
        durations.add(duration);
        listener.finished(_result);
        listener.closeQuietly();
        result = _result;
        try {
            save();
        } catch (IOException x) {
            LOGGER.log(Level.WARNING, null, x);
        }
    }
}

From source file:io.microprofile.showcase.speaker.domain.VenueJavaOne2016.java

private Speaker processSpeakerToken(final String token) {
    final Speaker speaker = new Speaker();
    speaker.setId(UUID.randomUUID().toString());
    //System.out.println("token = " + token);

    try (InputStream is = IOUtils.toInputStream(token, Charset.forName("UTF-8"))) {
        final StreamLexer lexer = new StreamLexer(is);
        speaker.setPicture(this.getImage(lexer));

        final String fullName = lexer.readToken("<h4>", "</h4>");
        speaker.setNameFirst(fullName.substring(0, fullName.indexOf(" ")));
        speaker.setNameLast(fullName.substring(fullName.indexOf(" ") + 1));

        speaker.setBiography(lexer.readToken("<p>", "</p>"));
        speaker.setTwitterHandle(lexer.readToken("href=\"https://twitter.com/", "\">@"));

    } catch (final Exception e) {
        this.log.log(Level.SEVERE, "Failed to parse token: " + token, e);
    }//ww  w .j av a 2s  .co  m

    this.log.log(Level.FINE, "Found:" + speaker);

    return speaker;
}

From source file:ca.sfu.federation.utils.IContextUtils.java

public static void logUpdateOrder(INamed Parent, List<INamed> Elements) {
    if (Parent != null && Elements != null) {
        Iterator en = Elements.iterator();
        StringBuilder sb = new StringBuilder();
        sb.append(Parent.getName());/*from  w  w w  .  j a v a  2 s  . com*/
        sb.append(" update event. Update sequence is: ");
        while (en.hasNext()) {
            INamed named = (INamed) en.next();
            sb.append(named.getName());
            sb.append(" ");
        }
        logger.log(Level.FINE, sb.toString());
    }
}

From source file:com.stratuscom.harvester.deployer.StarterServiceDeployer.java

public void addPlatformCodebaseJars(CodebaseContext codebaseContext) throws IOException {
    ASTcodebase codebaseNode = (ASTcodebase) configNode
            .search(new Class[] { ASTconfig.class, ASTclassloader.class, ASTcodebase.class }).get(0);
    /*//ww  w .j a va 2s  .c o  m
     Register the platform codebase jars with the codebase service.
     */
    for (int i = 0; i < codebaseNode.jjtGetNumChildren(); i++) {
        String jarFile = codebaseNode.jjtGetChild(i).toString();
        FileObject fo = fileUtility.getLibDirectory().resolveFile(jarFile);
        codebaseContext.addFile(fo);
        log.log(Level.FINE, MessageNames.ADDED_PLATFORM_CODEBASE_JAR, jarFile);
    }
}