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:com.aalto.repo.ProjectRepoImpl.java

public Long save(Project project) {
    Long pid = this.projectCounter.incrementAndGet();
    project.setPid(pid);//from w w w. j a  va 2s.com
    Logger.getLogger("repo").log(Level.INFO, "Project repo impl save project");
    Logger.getLogger("repo").log(Level.INFO, String.valueOf(project.getPid()));
    this.redisTemplate.opsForHash().put(PROJECT_KEY, project.getPid(), project);
    return pid;

}

From source file:org.apache.camel.component.bonita.api.util.BonitaAPIUtil.java

public static BonitaAPIUtil getInstance(BonitaAPIConfig bonitaAPIConfig) {
    if (instance == null) {
        instance = new BonitaAPIUtil();
        ClientConfig clientConfig = new ClientConfig();
        clientConfig.register(MultiPartFeature.class);
        clientConfig.register(JacksonJsonProvider.class);
        Logger logger = Logger.getLogger("org.bonitasoft.camel.bonita.api.util.BonitaAPIUtil");

        Feature feature = new LoggingFeature(logger, Level.INFO, null, null);
        clientConfig.register(feature);//w w w  . java  2 s .c  o  m
        ClientBuilder clientBuilder = ClientBuilder.newBuilder().withConfig(clientConfig);
        Client client = clientBuilder.build();
        client.register(new JsonClientFilter());
        client.register(new BonitaAuthFilter(bonitaAPIConfig));
        instance.setWebTarget(client.target(bonitaAPIConfig.getBaseBonitaURI()));
    }
    return instance;
}

From source file:org.hydroponics.web.controller.ImageController.java

@RequestMapping(value = "/{id}.jpg", method = RequestMethod.GET)
public String imageHandler(@PathVariable int id, @RequestParam(value = "type", required = false) String type,
        Model model) {/*from w ww.j  ava2s . c o m*/
    if (logger.isLoggable(Level.INFO))
        logger.info("Get Image: " + id);
    model.addAttribute(ImageServlet.IMAGE, hydroponicsDao.getImageById(id, type));
    System.out.println("model:" + model);
    return "image";
}

From source file:edu.unc.irss.arc.de.dvpublisher.DataverseClient.java

public void publishDatafile(String persistentId, File file) {

    if (StringUtils.isBlank(persistentId)) {
        throw new IllegalArgumentException("persistentId should not be blank");
    } else if (persistentId.startsWith("doi:")) {
        persistentId = persistentId.replace("doi:", "");
    }/*from  ww w.  j av a  2 s  .  c om*/

    if (!file.exists() || file.length() == 0L) {
        throw new IllegalArgumentException("A target file must exit and be non-empty");
    }

    logger.log(Level.INFO, "persistentId={0}", persistentId);
    apiClient.getDatasetOperations().uploadFile(persistentId, file);

}

From source file:eu.creatingfuture.propeller.webLoader.servlets.WebRequestServlet.java

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    resp.addHeader("Access-Control-Allow-Origin", "*");
    String getUrl = req.getParameter("get");
    if (getUrl == null) {
        resp.sendError(400);//from   ww  w  .j  a  v a2s  . co  m
        return;
    }
    logger.info(getUrl);
    URL url;
    HttpURLConnection connection = null;
    try {
        url = new URL(getUrl);
        connection = (HttpURLConnection) url.openConnection();
        connection.setRequestMethod("GET");
        connection.setUseCaches(false);

        resp.setContentType(connection.getContentType());
        resp.setContentLengthLong(connection.getContentLengthLong());
        logger.log(Level.INFO, "Content length: {0} response code: {1} content type: {2}", new Object[] {
                connection.getContentLengthLong(), connection.getResponseCode(), connection.getContentType() });
        resp.setStatus(connection.getResponseCode());
        IOUtils.copy(connection.getInputStream(), resp.getOutputStream());
    } catch (IOException ioe) {
        resp.sendError(500, ioe.getMessage());
    } finally {
        if (connection != null) {
            connection.disconnect();
        }
    }
}

From source file:uk.trainwatch.util.config.impl.HttpConfiguration.java

private synchronized void loadConfiguration() {
    if (configuration == null) {
        // Don't write uri as is as we may expose security details
        LOG.log(Level.INFO,
                () -> "Retrieving config " + uri.getScheme() + "://" + uri.getHost() + uri.getPath());

        try (CloseableHttpClient client = HttpClients.createDefault()) {
            int retry = 0;
            do {//from   w  ww.jav a2  s  .  co m
                try {
                    if (retry > 0) {
                        LOG.log(Level.INFO, "Sleeping {0}ms attempt {1}/{2}",
                                new Object[] { RETRY_DELAY, retry, MAX_RETRY });
                        Thread.sleep(RETRY_DELAY);
                    }
                    HttpGet get = new HttpGet(uri);
                    get.setHeader("User-Agent", "Area51 Configuration/1.0");

                    try (CloseableHttpResponse response = client.execute(get)) {
                        switch (response.getStatusLine().getStatusCode()) {
                        case 200:
                        case 304:
                            try (InputStream is = response.getEntity().getContent()) {
                                try (JsonReader r = Json.createReader(new InputStreamReader(is))) {
                                    configuration = new MapConfiguration(
                                            MapBuilder.fromJsonObject(r.readObject()).build());
                                    return;
                                }
                            }

                        default:
                            LOG.log(Level.WARNING, () -> "Error " + uri.getScheme() + "://" + uri.getHost()
                                    + uri.getPath() + " " + response.getStatusLine().getStatusCode());
                        }
                    }
                } catch (ConnectException ex) {
                    if (retry < MAX_RETRY) {
                        LOG.log(Level.WARNING, () -> "Failed " + ex.getMessage());
                    } else {
                        throw ex;
                    }
                } catch (InterruptedException ex) {
                    LOG.log(Level.SEVERE, null, ex);
                }

                retry++;
            } while (retry < MAX_RETRY);
        } catch (IOException ex) {
            throw new UncheckedIOException(ex);
        }

        configuration = EmptyConfiguration.INSTANCE;
    }
}

From source file:org.cloudifysource.azure.CliAzureDeploymentTest.java

private static void log(String message, Throwable t) {
    logger.log(Level.INFO, message, t);
}

From source file:com.plan.proyecto.servicios.login.LoginImplTest.java

/**
 * Test of login method, of class LoginImpl.
 *///from  ww w. j a  va2  s.  c o  m
@Test
public void testLogin() {
    log.log(Level.INFO, "Login");
    log.log(Level.INFO, "Prueba de login");

    String password = "abcd";
    String email = "dddd@aaaaa.com";
    String nombre = "cesar";
    Date fecha = new Date();

    Cuenta cuenta = new Cuenta(email, password, nombre, fecha);
    cuenta.setEmail(email);
    cuenta.setPassword(password);

    cuenta = gc.AltaCuenta(cuenta);

    Cuenta result = gl.autenticarse(email, password);

    assertNotNull(result);

    log.log(Level.INFO, "Prueba de login correcto terminada");

    result = gl.autenticarse("aaa", "bbb");
    assertNull(result);
    log.log(Level.INFO, "Prueba de login incorrecto terminada");
}

From source file:net.chrissearle.flickrvote.web.FlickrCallbackAction.java

public String execute() throws Exception {
    Photographer photographer = new DisplayPhotographer(photographyService.checkLoginAndStore(frob));

    session.put(FlickrVoteWebConstants.FLICKR_USER_SESSION_KEY, photographer);

    if (logger.isLoggable(Level.INFO)) {
        logger.info(photographer.getPhotographerName() + " just logged in");
    }/*from w  ww .j  a va 2s .  co  m*/

    return ActionSupport.SUCCESS;
}

From source file:com.intbit.CropImage.java

/**
 * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
 * methods./*from ww  w .  java 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
 */

@Override
public void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    super.processRequest(request, response);
    response.setContentType("text/html;charset=UTF-8");
    Date date = new Date();
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHH:mm:ssSSS");
    PrintWriter out = response.getWriter();
    logger.log(Level.INFO, "enter in servlet");
    //        sqlmethods.session = request.getSession(true);
    StringBuffer string_buffer = new StringBuffer();
    boolean check = true;
    try {

        String imageData = request.getParameter("image");

        imageData = imageData.replaceAll("^data:image[^;]+;base64,", "");
        logger.log(Level.INFO, getServletContext().getRealPath(""));
        byte[] data = Base64.decodeBase64(imageData);
        try (OutputStream stream = new FileOutputStream(getServletContext().getRealPath("")
                + "/images/temp_image/" + dateFormat.format(date) + ".png")) {
            stream.write(data);
            response.setContentType("text/plain");
            response.getWriter().write(dateFormat.format(date) + ".png");
        }
    } catch (Exception e) {
        logger.log(Level.SEVERE, util.Utility.logMessage(e, "Exception while updating org name:",
                getSqlMethodsInstance().error));

    } finally {
        out.close();
        getSqlMethodsInstance().closeConnection();
    }
}