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:at.ac.tuwien.dsg.cloudlyra.utils.RestHttpClient.java

public void callPostMethod(List<NameValuePair> paramList) {

    try {/*w  ww  .j a va2s.  co m*/

        HttpPost post = new HttpPost(url);

        // add header
        post.setHeader("Host", "smartsoc.infosys.tuwien.ac.at");
        //post.setHeader("User-Agent", USER_AGENT);
        //post.setHeader("Connection", "keep-alive");
        post.setHeader("Content-Type", "application/x-www-form-urlencoded");

        // set content
        post.setEntity(new UrlEncodedFormEntity(paramList));

        logger.log(Level.INFO, "\nSending 'POST' request to URL : " + url);
        logger.log(Level.INFO, "Post parameters : " + paramList);
        System.out.println();

        HttpClient client = HttpClientBuilder.create().build();
        HttpResponse response = client.execute(post);

        int responseCode = response.getStatusLine().getStatusCode();

        logger.log(Level.INFO, "Response Code : " + responseCode);

        BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));

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

        logger.log(Level.INFO, result.toString());

    } catch (Exception ex) {

    }

}

From source file:muscle.core.CxADescription.java

private CxADescription() {
    tmpDir = JVM.ONLY.tmpDir();//from www .  j  av  a 2  s.c  o m
    logger.log(Level.INFO, "Using directory <{0}>", tmpDir);

    description = new HashMap<String, Object>();

    final String envFilename = System.getProperty(ENV_PROPERTY);
    if (envFilename == null) {
        logger.severe("Property muscle.Env is not specified; cannot start MUSCLE");
        System.exit(1);
    } else {
        try {
            final File envFile = new File(envFilename);
            Reader reader = new BufferedReader(new FileReader(envFile));
            // treat input as a org.json.simple.JSONObject and put in our env
            @SuppressWarnings("unchecked")
            Map<String, Object> jsonHash = (Map<String, Object>) JSONValue.parse(reader);
            @SuppressWarnings("unchecked")
            Map<String, Object> cxaParams = (Map<String, Object>) jsonHash.get(CXA_KEY);
            if (cxaParams == null) {
                logger.severe("CxA parameters are not passed in the configuration.");
                System.exit(1);
            }
            // load (mandatory) cxa properties from muscle environment
            description.putAll(cxaParams);
        } catch (FileNotFoundException e) {
            logger.log(Level.SEVERE,
                    "Cannot load MUSCLE parameters from <" + envFilename + ">: path does not exist", e);
            System.exit(1);
        }
    }
}

From source file:fx.browser.Window.java

public void setLocation(String location) throws URISyntaxException {
    System.out.println("# " + this.toString() + "-Classloader: " + getClass().getClassLoader().toString()
            + " setLocation()");
    this.location = location;
    HttpGet httpGet = new HttpGet(new URI(location));

    try (CloseableHttpResponse response = Browser.getHttpClient().execute(httpGet)) {
        switch (response.getStatusLine().getStatusCode()) {

        case HttpStatus.SC_OK:
            FXMLLoader loader = new FXMLLoader();
            Header header = response.getFirstHeader("class-loader-url");

            if (header != null) {
                URL url = new URL(location);

                url = new URL(url.getProtocol(), url.getHost(), url.getPort(), header.getValue());
                if (logger.isLoggable(Level.INFO)) {
                    logger.log(Level.INFO, "Set up remote classloader: {0}", url);
                }//  w w w .  ja v a2 s .  c  o  m

                loader.setClassLoader(HttpClassLoader.getInstance(url, getClass().getClassLoader()));
            }

            try {
                ByteArrayOutputStream buffer = new ByteArrayOutputStream();

                response.getEntity().writeTo(buffer);
                response.close();
                setContent(loader.load(new ByteArrayInputStream(buffer.toByteArray())));
            } catch (Exception e) {
                response.close();
                logger.log(Level.INFO, e.toString(), e);
                Node node = loader.load(getClass().getResourceAsStream("/fxml/webview.fxml"));
                WebViewController controller = (WebViewController) loader.getController();

                controller.view(location);
                setContent(node);
            }

            break;

        case HttpStatus.SC_UNAUTHORIZED:
            response.close();
            Optional<Pair<String, String>> result = new LoginDialog().showAndWait();

            if (result.isPresent()) {
                URL url = new URL(location);

                Browser.getCredentialsProvider().setCredentials(new AuthScope(url.getHost(), url.getPort()),
                        new UsernamePasswordCredentials(result.get().getKey(), result.get().getValue()));
                setLocation(location);
            }

            break;
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:com.johncroth.histo.logging.LogHistogramWriterParserTest.java

@Test
public void testLogFormatter() {
    LogRecord lr = new LogRecord(Level.INFO, "foo");
    assertEquals("foo\n", LogHistogramWriter.createJavaLoggingFormatter().format(lr));
}

From source file:com.oic.net.WebSocketListener.java

@OnWebSocketMessage
public void onText(String message) {
    String method = "";
    JSONObject json = new JSONObject();
    try {//from w w  w.ja v a2 s.  c o  m
        json = (JSONObject) (new JSONParser().parse(message));
        LOG.log(Level.INFO, "method : {0}", json.get("method"));
        //LOG.log(Level.INFO, "status : {0}", login);
        method = json.get("method").toString();
    } catch (ParseException e) {
        LOG.log(Level.WARNING, "{0}", e);
    }

    /* ?  */
    selectMessage(method, json, this);
}

From source file:com.telefonica.euro_iaas.sdc.dao.impl.FileDaoWebDavImpl.java

/**
 * {@inheritDoc}/*from  w  w  w  .j a  v a2 s .c o m*/
 */
@Override
public void createDirectory(String webdavDirectoryUrl) throws SardineException {
    Sardine sardine;
    sardine = SardineFactory.begin(propertiesProvider.getProperty(WEBDAV_USERNAME),
            propertiesProvider.getProperty(WEBDAV_PASSWD));
    sardine.createDirectory(webdavDirectoryUrl);
    LOGGER.log(Level.INFO, webdavDirectoryUrl + " CREATED ");
}

From source file:by.bsuir.finance.controllers.AdminController.java

@RequestMapping(value = "/edit", method = RequestMethod.GET)
@ResponseBody//from  w  ww. j  a va2s .  com
public ModelAndView editUser(@RequestParam("idUserInfo") int idUserInfo) {
    log.log(Level.INFO, "edit user id = {0}", idUserInfo);
    ModelAndView model = new ModelAndView("admin/edit");
    System.out.println("lol");
    //model.addObject("user", infoRepository.findByIdUsername(((Number)idUsername).longValue()));
    return model;
}

From source file:at.ac.tuwien.swtm.analytics.mainspring.client.adapter.EventDataAdapter.java

public void setTimestamp(String timestamp) {

    try {//from   w  w  w.j av a 2s.c o  m
        event.setTimeStamp(df.parse(timestamp));
    } catch (Exception ex) {
        event.setTimeStamp(null);
        logger.log(Level.INFO, "Could not parse date, timestamp={0}{2}",
                new Object[] { timestamp, ex.toString() });
    }
}

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

@SuppressWarnings("restriction")
public FlexiantConnector(String endPoint, String login, String secretKey) throws MalformedURLException {
    this.endpoint = endPoint;
    System.setProperty("jsse.enableSNIExtension", "false");

    journal.log(Level.INFO, ">> Connecting to Flexiant ...");

    URL url = ClassLoader.getSystemClassLoader().getResource("UserAdmin.wsdl");

    // Get the UserAPI
    UserAPI api = new UserAPI(url, new QName("http://extility.flexiant.net", "UserAPI"));

    // and set the service port on the service
    service = api.getUserServicePort();/*from   w w w. j  a  v  a2 s . c o  m*/

    // Get the binding provider
    BindingProvider portBP = (BindingProvider) service;

    // and set the service endpoint
    portBP.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endPoint);

    journal.log(Level.INFO, ">> Authenticating ...");
    // and the caller's authentication details and password
    portBP.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, login);
    portBP.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, secretKey);

}

From source file:me.st28.flexseries.flexlib.log.LogHelper.java

private static void logFromClass(Level level, Class clazz, String message) {
    Validate.notNull(clazz, "Class cannot be null.");
    Validate.notNull(message, "Message cannot be null.");

    if (FlexPlugin.class.isAssignableFrom(clazz)) {
        JavaPlugin plugin = JavaPlugin.getPlugin(clazz);

        if (plugin == null) {
            throw new IllegalArgumentException("Plugin '" + clazz.getCanonicalName() + "' not found.");
        }//from w  w  w  . j a  va2  s  .  c  om

        if (!(plugin instanceof FlexPlugin)) {
            throw new IllegalArgumentException("Plugin '" + plugin.getName() + "' is not a FlexPlugin.");
        }

        FlexPlugin fp = (FlexPlugin) plugin;

        if (level == Level.INFO) {
            info(fp, message);
        } else if (level == Level.WARNING) {
            warning(fp, message);
        } else if (level == Level.SEVERE) {
            severe(fp, message);
        } else if (level == null) {
            debug(fp, message);
        }
        throw new IllegalArgumentException("Invalid log level '" + level.getName() + "'");
    }

    if (FlexModule.class.isAssignableFrom(clazz)) {
        throw new IllegalArgumentException("Invalid log level '" + level.getName() + "'");
    }

    throw new IllegalArgumentException(
            "Class '" + clazz.getCanonicalName() + "' must be an instance of FlexPlugin or FlexModule.");
}