Example usage for java.util.logging Level INFO

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

Introduction

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

Prototype

Level INFO

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

Click Source Link

Document

INFO is a message level for informational messages.

Usage

From source file:EntityClustering.MarkovClustering.java

public MarkovClustering() {
    similarityGraph = new SimpleGraph(DefaultEdge.class);
    LOGGER.log(Level.INFO, "Initializing Connected Components clustering...");
}

From source file:cz.muni.fi.pa165.creatures.rest.client.services.utils.CRUDServiceHelper.java

/**
 * Helper methods which executes an HTTP {@code method} and writes the
 * output to the standard output (e.g. console). Return codes of the HTTP
 * responses are present so we can verify what happened at the server side.
 *
 * @param method method to send to the server side
 *//*from w w w.j a  va  2  s . c o m*/
public static void send(HttpMethodBase method) {
    HttpClient httpClient = new HttpClient();
    try {

        int result = httpClient.executeMethod(method);
        System.out.println(RESPONSE_STATUS_CODE + result);
        ResponseCode response = ResponseCode.fromInt(result);
        if (response != ResponseCode.NOT_FOUND && response != ResponseCode.SERVER_ERROR
                && response != ResponseCode.FORBIDDEN) {
            System.out.println(RESPONSE_HEADER);

            Header[] headers = method.getResponseHeaders();
            for (Header h : headers) {
                System.out.println(h.toString());
            }

            InputStreamReader isr = new InputStreamReader(method.getResponseBodyAsStream());
            BufferedReader br = new BufferedReader(isr);

            String line;

            while ((line = br.readLine()) != null) {
                System.out.println(line);
            }
        }
    } catch (ConnectException ex) {
        logger.log(Level.WARNING, CONNECTION_EXCEPTION_MSG);
    } catch (IOException ex) {
        logger.log(Level.INFO, ex.getMessage());
    } finally {
        method.releaseConnection();
    }
}

From source file:au.edu.unimelb.plantcell.onekp.icprot.servlets.SubfolderTableVisitor.java

@Override
public String toString() {
    int carousel_id = 1;
    StringBuilder sb = new StringBuilder();

    if (dir2files.keySet().isEmpty()) {
        sb.append("<p>No files available for download.</p>");
        return sb.toString();
    }/*from www .  ja  v  a2s  .c  o m*/

    log.log(Level.INFO, "Found {0} folders to scan for suitable downloads",
            new Object[] { dir2files.keySet().size() });

    List<File> sorted_dirs = new ArrayList<>();
    sorted_dirs.addAll(dir2files.keySet());
    Collections.sort(sorted_dirs, (final File o1, final File o2) -> {
        // length of absolute path is used for comparison for now...
        int len1 = o1.getAbsolutePath().length();
        int len2 = o2.getAbsolutePath().length();
        if (len1 < len2) {
            return -1;
        } else if (len1 > len2) {
            return 1;
        } else {
            return 0;
        }
    });
    FolderDescription fd = new FolderDescription(cb);
    for (File folder : sorted_dirs) {
        List<File> files = dir2files.get(folder);
        if (files.isEmpty()) {
            log.log(Level.INFO, "Found no files for {0}... ignoring",
                    new Object[] { folder.getAbsolutePath() });
            continue;
        }
        log.log(Level.INFO, "Processing folder {0}", new Object[] { folder.getAbsolutePath() });

        ArrayList<File> other_files = new ArrayList<>();
        ArrayList<File> image_files = new ArrayList<>();
        separateImagesFromOtherFiles(files, image_files, other_files);

        if (other_files.size() < 1) {
            log.log(Level.INFO, "Zero other files but found {0} image files in {1}",
                    new Object[] { image_files.size(), folder.getAbsolutePath() });
            if (image_files.size() > 0) {
                sb.append(fd.get(folder));
            }
            carousel_id++;
            continue;
        }
        log.log(Level.INFO, "File sizes: {0} {1} {2}",
                new Object[] { files.size(), image_files.size(), other_files.size() });

        String suffix = folder.getAbsolutePath();
        if (suffix.startsWith(prefix)) {
            suffix = suffix.substring(prefix.length());
            while (suffix.startsWith("/")) {
                suffix = suffix.substring(1);
            }
        }
        String heading = StringEscapeUtils.escapeHtml4(suffix);

        log.log(Level.INFO, "Heading is {0}, suffix is {1}, folder is {2}",
                new Object[] { heading, suffix, folder });
        if (heading.length() > 0) {
            sb.append(fd.get(folder)); // NB: we assume in this case that <h3> is provided by fd.get()
        } else {
            if (sorted_dirs.size() > 1) {
                sb.append(fd.get(folder));
            } else {
                // even in the case where there is a single folder, we give FolderDescription a chance
                // to add a narrative to the page, not just the downloads
                String descr = fd.get(folder);
                if (descr != null && descr.length() > 0) {
                    sb.append(descr);
                }
            }
        }

        boolean make_collapsed_table = (other_files.size() > 20);
        if (make_collapsed_table) {
            String table_id = "table" + n_large_tables++;
            sb.append(
                    "<button type=\"button\" class=\"btn btn-info\" data-toggle=\"collapse\" data-target=\"#");
            sb.append(table_id);
            sb.append("\">Show/hide files</button>");
            sb.append("<div id=\"");
            sb.append(table_id);
            sb.append("\" class=\"collapse\">");
        }
        sb.append("<table class=\"table table-condensed\">");
        sb.append("<tr>");
        sb.append("<th>Name</th>");
        sb.append("<th>Size</th>");
        sb.append("<th>Last modified</th>");
        sb.append("</tr>");

        for (File f : other_files) {
            sb.append("<tr>");
            sb.append("<td>");
            suffix = f.getName();
            if (suffix.startsWith(prefix)) {
                suffix = suffix.substring(prefix.length());
                while (suffix.startsWith("/")) {
                    suffix = suffix.substring(1);
                }
            }
            sb.append("<a href=\"services/FileDownload?attachment=1&file=");
            String encoded = Base64.getEncoder().encodeToString(f.getAbsolutePath().getBytes());
            sb.append(encoded);
            sb.append("\">");
            sb.append(StringEscapeUtils.escapeHtml4(suffix));
            sb.append("</a>");
            sb.append("</td>");
            sb.append("<td>");
            sb.append(StringEscapeUtils.escapeHtml4(ServiceCore.readableFileSize(f.length())));
            sb.append("</td>");

            // last modified
            long yourmilliseconds = System.currentTimeMillis();
            SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy HH:mm");
            Date resultdate = new Date(f.lastModified());
            sb.append("<td>");
            sb.append(StringEscapeUtils.escapeHtml4(sdf.format(resultdate)));
            sb.append("</td>");
            sb.append("</tr>");
        }
        sb.append("</table>");
        if (make_collapsed_table) {
            sb.append("</div>");
        }
    }

    log.log(Level.INFO, "Resulting HTML has length: {0}", new Object[] { sb.length() });
    return sb.toString();
}

From source file:com.medlog.webservice.lifecycle.NewServletListener.java

@Override
public void contextInitialized(ServletContextEvent _sce) {
    LOG.log(Level.INFO, String.format("$$$$$$$$ com.medlog.webservice.lifecycle.NewServletListener# %s ",
            _sce.getServletContext().getContextPath()));
    System.out.println("\ncom.medlog.webservice.lifecycle.NewServletListener.contextInitialized() ---> "
            + _sce.getServletContext().getServerInfo());
    _sce.getServletContext().setAttribute("activeLogins", 1);

}

From source file:ca.sfu.federation.action.SetLayoutToIContextModelViewAction.java

/**
 * Set the current context./*from  w  w  w .  j  a  v  a  2  s  .  c  o m*/
 * @param e Action event.
 */
@Override
public void actionPerformed(ActionEvent e) {
    logger.log(Level.INFO, "Change application layout to ScenarioModelView. Not implemented yet.");
}

From source file:at.ac.tuwien.dsg.cloudlyra.utils.RestfulWSClient.java

public void callPutMethod(String xmlString) {

    try {/* w  ww .java 2s.c  o m*/

        //HttpGet method = new HttpGet(url);
        StringEntity inputKeyspace = new StringEntity(xmlString);

        Logger.getLogger(RestfulWSClient.class.getName()).log(Level.INFO, "Connection .. " + url);

        HttpPut request = new HttpPut(url);
        request.addHeader("content-type", "application/xml; charset=utf-8");
        request.addHeader("Accept", "application/xml, multipart/related");
        request.setEntity(inputKeyspace);

        HttpResponse methodResponse = this.getHttpClient().execute(request);

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

        Logger.getLogger(RestfulWSClient.class.getName()).log(Level.INFO, "Status Code: " + statusCode);
        BufferedReader rd = new BufferedReader(new InputStreamReader(methodResponse.getEntity().getContent()));

        StringBuilder result = new StringBuilder();
        String line;
        while ((line = rd.readLine()) != null) {
            result.append(line);
        }

        // System.out.println("Response String: " + result.toString());
    } catch (Exception ex) {

    }

}

From source file:net.sf.jsqlparser.statement.select.SpecialOracleTest.java

@Test
public void testAllSqlsParseDeparse() throws IOException {
    int count = 0;
    int success = 0;
    File[] sqlTestFiles = SQLS_DIR.listFiles();

    for (File file : sqlTestFiles) {
        if (file.isFile()) {
            count++;//from w w  w . j  a  v a 2s .  c  o m
            LOG.log(Level.INFO, "testing {0}", file.getName());
            String sql = FileUtils.readFileToString(file);
            try {
                assertSqlCanBeParsedAndDeparsed(sql, true);
                success++;
                LOG.info("   -> SUCCESS");
            } catch (JSQLParserException ex) {
                ex.printStackTrace();
                //LOG.log(Level.SEVERE, null, ex);
                LOG.log(Level.INFO, "   -> PROBLEM {0}", ex.toString());
            } catch (Exception ex) {
                LOG.log(Level.INFO, "   -> PROBLEM {0}", ex.toString());
            } catch (ComparisonFailure ex) {
                LOG.log(Level.INFO, "   -> PROBLEM {0}", ex.toString());
            }
        }
    }

    LOG.log(Level.INFO, "tested {0} files. got {1} correct parse results", new Object[] { count, success });
    assertTrue(success >= 149);
}

From source file:net.chrissearle.flickrvote.flickr.impl.FlickrJImageDAO.java

private FlickrImage retrieveAndBuildImage(String id) throws IOException, FlickrException, SAXException {
    Photo photo = retrieveImage(id);//from  ww  w  .  j  a v  a 2 s  . c om

    if (logger.isLoggable(Level.INFO)) {
        logger.info("Image retrieved: " + id);
    }

    return buildImage(photo);
}

From source file:org.jaqpot.core.service.filter.excmappers.UnrecognizedPropertyMapper.java

@Override
public Response toResponse(UnrecognizedPropertyException exception) {
    LOG.log(Level.INFO, "UnrecognizedPropertyMapper exception caught", exception);
    StringWriter sw = new StringWriter();
    exception.printStackTrace(new PrintWriter(sw));
    String details = sw.toString();
    ErrorReport error = ErrorReportBuilder.builderRandomId().setCode("UnrecognisedProperty")
            .setMessage(exception.getMessage()).setDetails(details).setHttpStatus(400).build();
    return Response.ok(error, MediaType.APPLICATION_JSON).status(Response.Status.BAD_REQUEST).build();
}

From source file:org.cloudml.connectors.CloudFoundryConnector.java

public CloudFoundryConnector(String APIEndPoint, String login, String passwd, String organization,
        String space) {// www  .j  a va2 s . co  m
    try {
        URL cloudControllerUrl = URI.create(APIEndPoint).toURL();
        journal.log(Level.INFO, ">> Connecting to CloudFoundry ...");
        connectedClient = new CloudFoundryClient(new CloudCredentials(login, passwd), cloudControllerUrl,
                organization, space);
        connectedClient.login();
        defaultDomainName = connectedClient.getDefaultDomain().getName();
    } catch (MalformedURLException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}