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:edu.umass.cs.reconfiguration.reconfigurationutils.DynamoReplicaCoordinator.java

@Override
public boolean coordinateRequest(Request request, ExecutedCallback callback)
        throws IOException, RequestParseException {
    try {/*from   w w w  . j a  v  a2s.c  om*/
        log.log(Level.INFO, "{0} lazily coordinating {1}: {2}",
                new Object[] { this, request.getRequestType(), request });
        this.sendAllLazy(request);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    return true;
}

From source file:at.ac.tuwien.dsg.elasticdaasclient.testing.RestfulWSClient.java

public String callPutMethod(String xmlString) {
    String rs = "";

    try {/*from   w  w w  . ja  va2s  . 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);
        }

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

    }
    return rs;
}

From source file:org.deviceconnect.message.http.impl.factory.HttpRequestMessageFactory.java

@Override
public HttpRequest newPackagedMessage(final DConnectMessage message) {
    mLogger.entering(this.getClass().getName(), "newPackagedMessage", message);

    mLogger.fine("create http request from dmessage");
    HttpRequest request;// ww w.  j  av a2  s  .c  om
    try {
        request = createHttpRequest(message);
    } catch (URISyntaxException e) {
        mLogger.log(Level.INFO, e.toString(), e);
        mLogger.warning(e.toString());
        throw new IllegalArgumentException(e.toString());
    }

    mLogger.fine("put request headers");
    for (Header header : createHttpHeader(message)) {
        request.addHeader(header);
    }

    mLogger.fine("put request body");
    if (request instanceof HttpEntityEnclosingRequest) {
        HttpEntity entity = createHttpEntity(message);
        ((HttpEntityEnclosingRequest) request).setEntity(entity);
        request.addHeader(HTTP.CONTENT_LEN, "" + entity.getContentLength());
    } else {
        request.addHeader(HTTP.CONTENT_LEN, "0");
    }

    mLogger.exiting(this.getClass().getName(), "newPackagedMessage", request);
    return request;
}

From source file:cz.incad.kramerius.audio.servlets.ServletAudioHttpRequestForwarder.java

public Void forwardGetRequest(URL url) throws IOException, URISyntaxException {
    LOGGER.log(Level.INFO, "forwarding {0}", url);
    HttpGet proxyToRepositoryRequest = new HttpGet(url.toURI());
    forwardSelectedRequestHeaders(clientToProxyRequest, proxyToRepositoryRequest);
    //printRepositoryRequestHeaders(repositoryRequest);
    HttpResponse repositoryToProxyResponse = httpClient.execute(proxyToRepositoryRequest);
    //printRepositoryResponseHeaders(repositoryResponse);
    forwardSelectedResponseHeaders(repositoryToProxyResponse, proxyToClientResponse);
    forwardResponseCode(repositoryToProxyResponse, proxyToClientResponse);
    forwardData(repositoryToProxyResponse.getEntity().getContent(), proxyToClientResponse.getOutputStream());
    return null;/*from w  ww  .j a  v  a  2  s . c  om*/
}

From source file:de.static_interface.sinklibrary.util.Debug.java

public static void logMethodCall(@Nullable Object... arguments) {
    String args = "";
    if (arguments != null) {
        args = StringUtil.formatArrayToString(arguments, ", ");
    }//  ww  w .  ja v  a 2 s  . c  om
    args = "(" + args + ")";
    logInternal(Level.INFO, args, null);
}

From source file:dhz.skz.citaci.weblogger.WebloggerCitacBean.java

@Override
public Map<ProgramMjerenja, NizPodataka> procitaj(IzvorPodataka izvor) {
    log.log(Level.INFO, "POCETAK CITANJA");
    em.refresh(izvor);//from   w w w .  ja va 2  s  .c  o  m
    Collection<Postaja> postajeZaIzvor = dao.getPostajeZaIzvor(izvor);
    for (Postaja p : postajeZaIzvor) {
        log.log(Level.INFO, "Citam: {0}", p.getNazivPostaje());
        pokupiMjerenjaSaPostaje(izvor, p);
        zeroSpan.pokupiZeroSpanSaPostaje(izvor, p);
    }
    log.log(Level.INFO, "KRAJ CITANJA");
    return null;
}

From source file:net.sf.mpaxs.spi.computeHost.StartUp.java

/**
 *
 * @param cfg/*from  w  w  w .j  a v a 2s  . c  om*/
 */
public StartUp(Configuration cfg) {
    Settings settings = new Settings(cfg);
    try {
        System.setProperty("java.rmi.server.codebase", settings.getCodebase().toString());
        Logger.getLogger(StartUp.class.getName()).log(Level.INFO, "RMI Codebase at {0}",
                settings.getCodebase().toString());
    } catch (MalformedURLException ex) {
        Logger.getLogger(StartUp.class.getName()).log(Level.SEVERE, null, ex);
    }
    File policyFile;
    policyFile = new File(new File(settings.getOption(ConfigurationKeys.KEY_COMPUTE_HOST_WORKING_DIR)),
            settings.getPolicyName());
    if (!policyFile.exists()) {
        System.out.println("Did not find security policy, will create default one!");
        policyFile.getParentFile().mkdirs();
        BufferedReader br = new BufferedReader(new InputStreamReader(
                StartUp.class.getResourceAsStream("/net/sf/mpaxs/spi/computeHost/wideopen.policy")));
        try {
            BufferedWriter bw = new BufferedWriter(new FileWriter(policyFile));
            String s = null;
            while ((s = br.readLine()) != null) {
                bw.write(s + "\n");
            }
            bw.flush();
            bw.close();
            br.close();
            Logger.getLogger(StartUp.class.getName()).log(Level.INFO,
                    "Using security policy at " + policyFile.getAbsolutePath());
        } catch (IOException ex) {
            Logger.getLogger(StartUp.class.getName()).log(Level.SEVERE, null, ex);
        }
    } else {
        Logger.getLogger(StartUp.class.getName()).log(Level.INFO,
                "Found existing policy file at " + policyFile.getAbsolutePath());
    }
    System.setProperty("java.security.policy", policyFile.getAbsolutePath());

    System.setProperty("java.net.preferIPv4Stack", "true");

    if (System.getSecurityManager() == null) {
        System.setSecurityManager(new SecurityManager());
    }

    Logger.getLogger(StartUp.class.getName()).log(Level.FINE, "Creating host");
    Host h = new Host();
    Logger.getLogger(StartUp.class.getName()).log(Level.FINE, "Configuring host");
    h.configure(cfg);
    Logger.getLogger(StartUp.class.getName()).log(Level.FINE,
            "Setting auth token " + settings.getOption(ConfigurationKeys.KEY_AUTH_TOKEN));
    String at = settings.getOption(ConfigurationKeys.KEY_AUTH_TOKEN);
    h.setAuthenticationToken(UUID.fromString(at));
    Logger.getLogger(StartUp.class.getName()).log(Level.INFO, "Starting host {0}", settings.getHostID());
    h.startComputeHost();
}

From source file:com.anritsu.mcreleaseportal.utils.FileUpload.java

/**
 * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
 * methods./*  ww w .  ja v  a  2s  . co  m*/
 *
 * @param request servlet request
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    HttpSession session = request.getSession();
    session.setAttribute("mcPackage", null);
    PrintWriter pw = response.getWriter();
    response.setContentType("text/plain");
    ServletFileUpload upload = new ServletFileUpload();
    try {
        FileItemIterator iter = upload.getItemIterator(request);

        while (iter.hasNext()) {
            FileItemStream item = iter.next();
            InputStream stream = item.openStream();

            // Save input stream file for later use
            File dir = new File(Configuration.getInstance().getSavePath());
            if (!dir.exists() && !dir.isDirectory()) {
                dir.mkdir();
                LOGGER.log(Level.INFO, "Changes.xml archive directory was created at " + dir.getAbsolutePath());
            }
            String fileName = request.getSession().getId() + "_" + System.currentTimeMillis();
            File file = new File(dir, fileName);
            file.createNewFile();
            Path path = file.toPath();
            Files.copy(stream, path, StandardCopyOption.REPLACE_EXISTING);
            LOGGER.log(Level.INFO, "changes.xml saved on disk as: " + file.getAbsolutePath());

            // Save filename to session for next calls
            session.setAttribute("xmlFileLocation", file.getAbsolutePath());
            LOGGER.log(Level.INFO, "changes.xml saved on session as: fileName:" + file.getAbsolutePath());

            // Cleanup
            stream.close();

        }

    } catch (FileUploadException | IOException | RuntimeException e) {
        pw.println(
                "An error occurred when trying to process uploaded file! \n Please check the file consistency and try to re-submit. \n If the error persist pleace contact system administrator!");
    }
}

From source file:io.selendroid.standalone.server.grid.SelfRegisteringRemote.java

public void performRegistration() throws Exception {
    String tmp = config.getRegistrationUrl();

    HttpClient client = HttpClientUtil.getHttpClient();

    URL registration = new URL(tmp);
    if (log.isLoggable(Level.INFO)) {
        log.info("Registering selendroid node to Selenium Grid hub :" + registration);
    }//  w  ww .  j  a v a  2  s . c om
    BasicHttpEntityEnclosingRequest r = new BasicHttpEntityEnclosingRequest("POST",
            registration.toExternalForm());
    JSONObject nodeConfig = getNodeConfig();
    String nodeConfigString = nodeConfig.toString();
    if (log.isLoggable(Level.INFO)) {
        log.info("Registering selendroid node with following config:\n" + nodeConfigString);
    }
    r.setEntity(new StringEntity(nodeConfigString));

    HttpHost host = new HttpHost(registration.getHost(), registration.getPort());
    HttpResponse response = client.execute(host, r);
    if (response.getStatusLine().getStatusCode() != 200) {
        throw new SelendroidException("Error sending the registration request.");
    }
}

From source file:algorithm.laddress.java

/**
 * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
 * methods.//from  w ww .jav a 2  s  .co m
 *
 * @param request servlet request
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */

protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");

    // Create path components to save the file
    final String path = "C:\\Users\\Rads\\Documents\\NetBeansProjects\\capstone\\src\\java\\algorithm\\";
    final Part filePart = request.getPart("file");
    final String fileName = getFileName(filePart);

    OutputStream out = null;
    InputStream filecontent = null;
    final PrintWriter writer = response.getWriter();

    try {
        out = new FileOutputStream(new File(path + File.separator + fileName));
        filecontent = filePart.getInputStream();

        int read = 0;
        final byte[] bytes = new byte[1024];

        while ((read = filecontent.read(bytes)) != -1) {
            out.write(bytes, 0, read);
        }
        // writer.println("New file " + fileName + " created at " + path);
        LOGGER.log(Level.INFO, "File{0}being uploaded to {1}", new Object[] { fileName, path });
    } catch (FileNotFoundException fne) {
        writer.println("You either did not specify a file to upload or are "
                + "trying to upload a file to a protected or nonexistent " + "location.");
        writer.println("<br/> ERROR: " + fne.getMessage());

        LOGGER.log(Level.SEVERE, "Problems during file upload. Error: {0}", new Object[] { fne.getMessage() });
    }

    Scanner s = null;
    String listOfAddresses = "";
    try {
        String address = fileName;
        String dname = "C:\\Users\\Rads\\Documents\\NetBeansProjects\\capstone\\src\\java\\algorithm\\"
                + address;
        File f = new File(dname);
        s = new Scanner(f);
        //s.useDelimiter(",");   //Use the normal expression and exclude data we imagine they are not "WORDS"
    } catch (FileNotFoundException e) {

    }
    while (s.hasNextLine()) {
        String[] curr = s.nextLine().split(",");
        listOfAddresses = listOfAddresses + "<br/>" + curr[1];
    }
    String nextView = "user.jsp";
    request.setAttribute("Address", listOfAddresses);
    RequestDispatcher view = request.getRequestDispatcher(nextView);
    view.forward(request, response);
}