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:eu.trentorise.opendata.josman.test.GitTest.java

@Test
public void testReadRepo() throws IOException, GitAPIException {
    File repoFile = createSampleGitRepo();

    FileRepositoryBuilder builder = new FileRepositoryBuilder();
    Repository repo = builder.setGitDir(repoFile).readEnvironment() // scan environment GIT_* variables
            .findGitDir() // scan up the file system tree
            .build();//  ww w. j  av  a2s .  co  m

    LOG.log(Level.INFO, "directory: {0}", repo.getDirectory().getAbsolutePath());

    LOG.log(Level.INFO, "Having repository: {0}", repo.getDirectory().getAbsolutePath());

    LOG.log(Level.INFO, "current branch: {0}", repo.getBranch());
}

From source file:popo.defcon.MsgMeCDC.java

void Parse() {
    String input = readPage();/* ww  w  .j  a  v a2s. c  o m*/
    if (input == null) {
        System.out.println("Error connecting to Internet");
        return;
    }
    String time;
    Document cdc = Jsoup.parse(input);
    Elements notices = cdc.getElementsByTag("tbody");
    Elements alerts = notices.get(1).getElementsByTag("tr");
    alerts.remove(0);
    System.out.println("Current Old Time = " + oldtime);
    for (Element node : alerts) {
        Elements content = node.getElementsByTag("td");
        time = content.last().text();
        if (convertTime(time).compareTo(convertTime(oldtime)) <= 0) {
            MsgMeCDC.oldtime = alerts.get(0).getElementsByTag("td").last().text();
            return;
        }
        System.out.println("Current notice time :" + convertTime(time));
        Logger.getLogger(MsgMeCDC.class.getName()).log(Level.INFO, "Current notice time :" + convertTime(time));
        //for (Element text : content) {
        //    System.out.println(text.text());
        //}
        String smsTitle = content.get(1).text();
        //String smsCompanyName = content.get(2).text();
        String smsNoticeTime = content.get(4).text();
        String preSMStext = content.get(3).text();
        String randomtext = "Placement/ Internship Form Description Files";
        int start = preSMStext.indexOf(randomtext) + randomtext.length() + 1;
        int twilio = "Sent from your Twilio trial account - ".length();
        int end = 150 - (smsTitle.length() + smsNoticeTime.length() + twilio + 2);
        String smsContent = preSMStext.substring(start, start + end);
        String sms = smsTitle + '\n' + smsNoticeTime + '\n' + smsContent;
        System.out.println(sms);
        sendSMS(sms);
        Logger.getLogger(MsgMeCDC.class.getName()).log(Level.INFO, "SMS sent: " + sms);
        Logger.getLogger(MsgMeCDC.class.getName()).log(Level.INFO,
                "Length of SMS is " + (sms.length() + twilio));
        System.out.println("\nLength of SMS is " + (sms.length() + twilio));
        System.out.println("");
    }
    //System.out.println(notices.toString());
}

From source file:com.couchbase.client.protocol.views.ReducedOperationImpl.java

protected ViewResponseReduced parseResult(String json) throws ParseException {
    final Collection<ViewRow> rows = new LinkedList<ViewRow>();
    final Collection<RowError> errors = new LinkedList<RowError>();
    if (json != null) {
        try {//w ww  .ja  v  a2 s.  co m
            JSONObject base = new JSONObject(json);
            if (base.has("rows")) {
                JSONArray ids = base.getJSONArray("rows");
                for (int i = 0; i < ids.length(); i++) {
                    JSONObject elem = ids.getJSONObject(i);
                    String key = elem.getString("key");
                    String value = elem.getString("value");
                    rows.add(new ViewRowReduced(key, value));
                }
            }
            if (base.has("debug_info")) {
                LOGGER.log(Level.INFO, "Debugging View {0}: {1}", new Object[] { getView().getURI(), json });
            }
            if (base.has("errors")) {
                JSONArray ids = base.getJSONArray("errors");
                for (int i = 0; i < ids.length(); i++) {
                    JSONObject elem = ids.getJSONObject(i);
                    String from = elem.getString("from");
                    String reason = elem.getString("reason");
                    errors.add(new RowError(from, reason));
                }
            }
        } catch (JSONException e) {
            throw new ParseException("Cannot read json: " + json, 0);
        }
    }
    return new ViewResponseReduced(rows, errors);
}

From source file:fr.cnes.sitools.astro.resolver.IMCCESsoResolver.java

/**
 * Call the service/*from   w w  w .  j  a va 2s.co  m*/
 * @param objectName object name
 * @param epoch epoch
 * @throws NameResolverException 
 */
private void processResponse(String objectName, String epoch) throws NameResolverException {
    // building the query
    String service = hostResolverNameAtIMCCE.replace("<name>", objectName);
    service = service.replace("<epoch>", epoch);
    Logger.getLogger(IMCCESsoResolver.class.getName()).log(Level.INFO, "Call IMCCE name resolver: {0}",
            service);

    //requesting
    ClientResourceProxy client = new ClientResourceProxy(service, Method.GET);
    ClientResource clientResource = client.getClientResource();
    Status status = clientResource.getStatus();

    // when the response is fine, we process the response
    if (status.isSuccess()) {
        String result;
        try {
            result = clientResource.get().getText();
        } catch (IOException ex) {
            throw new NameResolverException(Status.SERVER_ERROR_INTERNAL, ex);
        } catch (ResourceException ex) {
            throw new NameResolverException(Status.SERVER_ERROR_INTERNAL, ex);
        }
        try {
            json = new JSONObject(result);
        } catch (JSONException ex) {
            try {
                json = new JSONArray(result);
            } catch (JSONException ex1) {
                throw new NameResolverException(Status.SERVER_ERROR_INTERNAL, ex1);
            }
        }
    } else {
        throw new NameResolverException(status, status.getDescription());
    }
}

From source file:net.erdfelt.android.sdkfido.project.FilteredFileUtil.java

public static String loadExpandedAsString(String resourceId, Map<String, String> props)
        throws OutputProjectException {
    LOG.log(Level.INFO, "Loading resource: " + resourceId);
    if (StringUtils.isBlank(resourceId)) {
        throw new IllegalArgumentException("resourceId cannot be blank");
    }/*from ww w  .j  av a  2 s  .  c  o m*/
    URL url = FilteredFileUtil.class.getResource(resourceId);
    if (url == null) {
        throw new OutputProjectException("Unable to find resourceID: " + resourceId);
    }

    InputStream in = null;
    InputStreamReader reader = null;
    BufferedReader buf = null;
    StringWriter writer = null;
    PrintWriter out = null;
    try {
        in = url.openStream();
        reader = new InputStreamReader(in);
        buf = new BufferedReader(reader);
        writer = new StringWriter();
        out = new PrintWriter(writer);

        PropertyExpander expander = new PropertyExpander(props);
        String line;

        while ((line = buf.readLine()) != null) {
            out.println(expander.expand(line));
        }

        out.flush();
        writer.flush();
        return writer.toString();
    } catch (IOException e) {
        throw new OutputProjectException("Unable to open input stream for url: " + url, e);
    } finally {
        IOUtils.closeQuietly(out);
        IOUtils.closeQuietly(writer);
        IOUtils.closeQuietly(buf);
        IOUtils.closeQuietly(reader);
        IOUtils.closeQuietly(in);
    }
}

From source file:hr.foi.sis.controllers.TestDataController.java

@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@PreAuthorize("isAuthenticated() and principal.idPerson == #id")
public ResponseEntity<List<TestData>> retrieveByPersonId(@PathVariable("id") long id) {

    Logger.getLogger("TestDataController.java").log(Level.INFO, "GET on /testdata/" + id);

    List<TestData> data = this.testDataRepository.findByPerson_IdPerson(id);

    if (data != null) {

        Logger.getLogger("TestDataController.java").log(Level.INFO, "Returning data  /testdata/" + id);

        return new ResponseEntity(data, HttpStatus.OK);
    } else {/*w w w .  j a  v  a 2s .c  om*/

        Logger.getLogger("TestDataController.java").log(Level.INFO, "Data not found");

        return new ResponseEntity(HttpStatus.BAD_REQUEST);

    }

}

From source file:com.seitenbau.jenkins.plugins.dynamicparameter.util.JenkinsUtils.java

/**
 * Execute the script locally with the given parameters and using the given class path.
 * @param script script to execute//  w w w.  j  ava  2s.co  m
 * @param parameters parameters
 * @param classPaths class paths
 * @return result from the script
 */
public static Object execute(String script, Map<String, String> parameters, FilePath[] classPaths) {
    try {
        CompilerConfiguration config = new CompilerConfiguration();

        // set class path
        ArrayList<String> classPathList = new ArrayList<String>(classPaths.length);
        try {
            for (FilePath path : classPaths) {
                String classPathString = path.absolutize().toURI().toURL().getPath();
                classPathList.add(classPathString);
                FilePath[] jars = path.list("*.jar");
                for (FilePath jar : jars) {
                    String jarClassPathString = jar.absolutize().toURI().toURL().getPath();
                    classPathList.add(jarClassPathString);
                }
            }
        } catch (Exception exp) {
            logger.log(Level.INFO, "Cannot access path", exp);
        }
        config.setClasspathList(classPathList);
        GroovyShell groovyShell = new GroovyShell(config);

        for (Entry<String, String> parameter : parameters.entrySet()) {
            groovyShell.setVariable(parameter.getKey(), parameter.getValue());
        }

        // execute script
        Object evaluate = groovyShell.evaluate(script);

        return evaluate;
    } catch (Exception e) {
        logger.log(Level.SEVERE, "Cannot access class path", e);
        return null;
    }
}

From source file:com.titankingdoms.nodinchan.mobjockeys.MobJockeys.java

/**
 * Initialises Metrics// www.ja  va  2s  . c o  m
 * 
 * @return True is Metrics is initialised
 */
private boolean initMetrics() {
    log(Level.INFO, "Hooking Metrics");

    try {
        Metrics metrics = new Metrics(this);

        if (metrics.isOptOut())
            return true;

        return metrics.start();

    } catch (Exception e) {
        return false;
    }
}

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

@OnWebSocketClose
public void onClose(int statusCode, String reason) {
    userLogout();// ww  w . ja  va 2  s. c o  m
    LOG.log(Level.INFO, "close statusCode = {0} reason = {1}", new Object[] { statusCode, reason });
}

From source file:fr.cnes.sitools.astro.resolver.CorotIdResolver.java

/**
 * Call the SITools2 service at IAS//from  w  w w .j  a v  a  2  s .c o m
 * @param query query
 * @throws IOException
 * @throws JSONException 
 */
private void process(final String query) throws NameResolverException {
    Logger.getLogger(CorotIdResolver.class.getName()).log(Level.INFO, "Call IAS name resolver: {0}", query);
    ClientResourceProxy proxy = new ClientResourceProxy(query, Method.GET);
    ClientResource client = proxy.getClientResource();
    client.setChallengeResponse(new ChallengeResponse(ChallengeScheme.HTTP_BASIC, "guest", "sitools2public"));
    Status status = client.getStatus();
    if (status.isSuccess()) {
        try {
            json = new JSONObject(client.get().getText());
        } catch (IOException ex) {
            throw new NameResolverException(Status.SERVER_ERROR_INTERNAL, ex);
        } catch (JSONException ex) {
            throw new NameResolverException(Status.SERVER_ERROR_INTERNAL, ex);
        } catch (ResourceException ex) {
            throw new NameResolverException(Status.SERVER_ERROR_INTERNAL, ex);
        }
    } else {
        throw new NameResolverException(status, status.getThrowable());
    }
}