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:io.selendroid.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);
    }//from   www .j a v  a2 s.c  om
    BasicHttpEntityEnclosingRequest r = new BasicHttpEntityEnclosingRequest("POST",
            registration.toExternalForm());
    JSONObject nodeConfig = getNodeConfig();
    r.setEntity(new StringEntity(nodeConfig.toString()));

    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:com.gallatinsystems.survey.dao.SurveyUtils.java

public static Survey copySurvey(Survey source, SurveyDto dto) {

    final SurveyDAO sDao = new SurveyDAO();
    final Survey tmp = new Survey();

    BeanUtils.copyProperties(source, tmp, Constants.EXCLUDED_PROPERTIES);
    // set name and surveyGroupId to values we got from the dashboard
    tmp.setCode(dto.getCode());/*w w w.  j  av  a  2  s.c o m*/
    tmp.setName(dto.getName());
    tmp.setSurveyGroupId(dto.getSurveyGroupId());

    tmp.setStatus(Survey.Status.COPYING);
    tmp.setPath(getPath(tmp));
    tmp.setVersion(Double.valueOf("1.0"));

    log.log(Level.INFO, "Copying `Survey` " + source.getKey().getId());
    final Survey newSurvey = sDao.save(tmp);

    log.log(Level.INFO, "New `Survey` ID: " + newSurvey.getKey().getId());

    SurveyUtils.copyTranslation(source.getKey().getId(), newSurvey.getKey().getId(), newSurvey.getKey().getId(),
            null, ParentType.SURVEY_NAME, ParentType.SURVEY_DESC);

    log.log(Level.INFO, "Running rest of copy functionality as a task...");

    final Queue queue = QueueFactory.getDefaultQueue();

    final TaskOptions options = TaskOptions.Builder.withUrl("/app_worker/dataprocessor")
            .param(DataProcessorRequest.ACTION_PARAM, DataProcessorRequest.COPY_SURVEY)
            .param(DataProcessorRequest.SURVEY_ID_PARAM, String.valueOf(newSurvey.getKey().getId()))
            .param(DataProcessorRequest.SOURCE_PARAM, String.valueOf(source.getKey().getId()));

    queue.add(options);

    return newSurvey;
}

From source file:net.chrissearle.spring.twitter.spring.Twitter4jTweetService.java

private void updateTwitterStatus(String text) {
    try {/*from  ww w .j  a  va2 s . c om*/
        twitter.updateStatus(text);
    } catch (TwitterException e) {
        if (e.getMessage().indexOf("Status is a duplicate") >= 0) {
            // A duplicate post means that the tweet wanted is the latest on the timeline.
            if (logger.isLoggable(Level.INFO)) {
                logger.info("Tweet was a duplicate");
            }

            return;
        }

        final String message = new StringBuilder().append("Unable to tweet: ").append(text).append(" due to ")
                .append(e.getMessage()).toString();

        if (logger.isLoggable(Level.WARNING)) {
            logger.warning(message);
        }

        throw new TwitterServiceException(message, e);
    }
}

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

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

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

private FlickrPhotographer retrieveAndBuildPhotographer(String id)
        throws IOException, SAXException, FlickrException {
    User user = retrieveUser(id);//from   w ww  . j  av  a 2 s. c o m

    if (logger.isLoggable(Level.INFO)) {
        logger.info("User info fetched for " + user.getUsername());
    }

    return buildPhotographer(user);
}

From source file:com.itcs.commons.email.impl.RunnableSendHTMLEmail.java

public void run() {
    Logger.getLogger(RunnableSendHTMLEmail.class.getName()).log(Level.INFO,
            "executing Asynchronous task RunnableSendHTMLEmail");
    try {//from ww  w  . ja va2  s.co  m
        HtmlEmail email = new HtmlEmail();
        email.setCharset("utf-8");
        email.setMailSession(getSession());
        for (String dir : to) {
            email.addTo(dir);
        }
        if (cc != null) {
            for (String ccEmail : cc) {
                email.addCc(ccEmail);
            }
        }
        if (cco != null) {
            for (String ccoEmail : cco) {
                email.addBcc(ccoEmail);
            }
        }
        email.setSubject(subject);
        // set the html message
        email.setHtmlMsg(body);
        email.setFrom(getSession().getProperties().getProperty(Email.MAIL_SMTP_FROM, Email.MAIL_SMTP_USER),
                getSession().getProperties().getProperty(Email.MAIL_SMTP_FROMNAME, Email.MAIL_SMTP_USER));
        // set the alternative message
        email.setTextMsg("Si ve este mensaje, significa que su cliente de correo no permite mensajes HTML.");
        // send the email
        if (attachments != null) {
            addAttachments(email, attachments);
        }
        email.send();
        Logger.getLogger(RunnableSendHTMLEmail.class.getName()).log(Level.INFO,
                "Email sent successfully to:{0} cc:{1} bcc:{2}",
                new Object[] { Arrays.toString(to), Arrays.toString(cc), Arrays.toString(cco) });
    } catch (EmailException e) {
        Logger.getLogger(RunnableSendHTMLEmail.class.getName()).log(Level.SEVERE,
                "EmailException Error sending email... with properties:\n" + session.getProperties(), e);
    }
}

From source file:com.zack6849.superlogger.Main.java

@Override
public void onEnable() {
    this.logger = getLogger();
    this.loggers = new ConcurrentHashMap<String, LoggerAbstraction>();
    saveDefaultConfig();//from  w w  w.j a v a  2s.co  m
    getConfig().setDefaults(new MemoryConfiguration());
    loadSettings();
    getServer().getPluginManager().registerEvents(new EventListener(this), this);
    try {
        Metrics metrics = new Metrics(this);
        metrics.start();
        logger.log(Level.INFO, "Metrics Running <3");
    } catch (IOException e) {
        logger.warning("There was an issue starting plugin metrics </3");
        logger.warning(e.getMessage());
        e.printStackTrace();
    }
    if (settings.isAutoUpdate()) {
        updater = new Updater(this, 45448, this.getFile(), Updater.UpdateType.DEFAULT, true);
    } else {
        updater = new Updater(this, 45448, this.getFile(), Updater.UpdateType.NO_DOWNLOAD, true);
    }
    if (settings.isDebug()) {
        for (String line : getDebug()) {
            debug(line);
        }
    }
}

From source file:org.sonews.daemon.CommandSelector.java

private void mapCommandStringsToInstance(Command command) {
    String[] cmdStrings = command.getSupportedCommandStrings();
    for (String cmdString : cmdStrings) {
        Log.get().log(Level.INFO, "Command {0} processed with {1}",
                new Object[] { cmdString, command.getClass() });
        commandMapping.put(cmdString, command);
    }//  w ww .j  a  v a  2s. c o  m
}

From source file:com.symbian.driver.remoting.packaging.installer.PackageInstaller.java

/**
 * /*from  w ww.  j  ava 2 s  .c o  m*/
 * @see com.symbian.driver.remoting.packaging.installer.Installer#Install(java.lang.String)
 */
public void Install(File aTestPackage) {
    try {

        TDConfig CONFIG = TDConfig.getInstance();
        File reposFile = CONFIG.getPreferenceFile(TDConfig.REPOSITORY_ROOT);
        File xmlRootFile = CONFIG.getPreferenceFile(TDConfig.XML_ROOT);
        File outLocation = CONFIG.getPreferenceFile(TDConfig.EPOC_ROOT);

        File out = aTestPackage;
        Zipper.Unzip(out, outLocation);

        Properties manifest = new Properties();
        manifest.load(new FileInputStream(
                (outLocation.getAbsolutePath() + File.separator + "Manifest.mf").replaceAll("\\\\+", "\\\\")));

        String platform = manifest.getProperty("platform");
        String romFile = manifest.getProperty("romFile");

        LOGGER.log(Level.INFO, "Package information: \n\t" + manifest.toString());

        // unzip it

        File lDep = new File((outLocation.getAbsolutePath() + File.separator + "Dependencies.zip")
                .replaceAll("\\\\+", "\\\\"));
        File repository = new File((outLocation.getAbsolutePath() + File.separator + "Repository.zip")
                .replaceAll("\\\\+", "\\\\"));
        File lXml = new File(
                (outLocation.getAbsolutePath() + File.separator + "Xml.zip").replaceAll("\\\\+", "\\\\"));
        File lStat = new File(
                (outLocation.getAbsolutePath() + File.separator + "Stat.zip").replaceAll("\\\\+", "\\\\"));

        try {
            if (lDep.exists()) {
                LOGGER.log(Level.INFO, "Unzipping " + lDep.toString());
                Zipper.Unzip(lDep, outLocation);
                lDep.delete();
            }
            if (repository.exists()) {
                LOGGER.log(Level.INFO, "Unzipping " + repository.toString());
                Zipper.Unzip(repository, reposFile);
                repository.delete();
            }
            if (lXml.exists()) {
                LOGGER.log(Level.INFO, "Unzipping " + lXml.toString());
                Zipper.Unzip(lXml, xmlRootFile);
                lXml.delete();
            }
            if (lStat.exists()) {
                LOGGER.log(Level.INFO, "Unzipping " + lStat.toString());
                Zipper.Unzip(lStat, outLocation);
                lStat.delete();
            }

            if (romFile != null) {
                if (Epoc.isTargetEmulator(platform)) {
                    File imageFile = new File(outLocation.getAbsolutePath(), romFile);
                    if (imageFile.exists()) {
                        LOGGER.log(Level.INFO, "Unzipping emulator image " + imageFile.toString());
                        Zipper.Unzip(imageFile, outLocation);
                        imageFile.delete();
                    }
                } else {
                    // write("Flashing "+romFile+" through port
                    // "+trgtestPort);
                    // restoreRom(romFile,platform,trgtestPort);
                }
            }
        } catch (IOException lE) {
            LOGGER.log(Level.SEVERE, "Failed to unzip file.", lE);
        }

    } catch (IOException lE) {
        LOGGER.log(Level.SEVERE, "package installation failed ", lE);
    } catch (ParseException e) {
        LOGGER.log(Level.SEVERE, "Could not get preference: " + e.getMessage(), e);
    }

}

From source file:eu.ubitech.sma.aggregator.scraper.FacebookClient.java

public String getUserFacebookPage(String username, String userFacebookPage) {

    Logger.getLogger(FacebookClient.class.getName()).log(Level.INFO, "Requested About page for user: {0}",
            username);/*from w w w .  j a  va  2 s.  c  o m*/
    String aboutPageText;
    //Check if a valid session to facebook exists
    if (!isClientLoggedIn()) {
        Logger.getLogger(FacebookClient.class.getName()).log(Level.INFO,
                "WebClient is not logged-in to facebook account");
        for (int tries = 1; tries <= MAX_RECONNECT_TIMES; tries++) {
            Logger.getLogger(FacebookClient.class.getName()).log(Level.INFO,
                    "WebClient is connecting to facebook... (tries: " + tries + "/" + MAX_RECONNECT_TIMES
                            + ")");
            if (loginToFacebook()) {
                break;
            } else if (tries == MAX_RECONNECT_TIMES) {
                return FacebookClientError.NOT_LOGGED_IN.toString();
            }
            Logger.getLogger(FacebookClient.class.getName()).log(Level.INFO,
                    "WebClient failed connecting to facebook retrying in " + MAX_RECONNECT_PAUSE_TIME / 1000
                            + " seconds...");
            try {
                Thread.sleep(MAX_RECONNECT_PAUSE_TIME);
            } catch (InterruptedException ex) {
                Logger.getLogger(FacebookClient.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }

    //Try to fetch users' about page
    try {
        HtmlPage aboutPage = webClient.getPage(FACEBOOK_PAGE + username + userFacebookPage);
        aboutPageText = aboutPage.asXml();
    } catch (IOException | FailingHttpStatusCodeException ex) {
        aboutPageText = FacebookClientError.PAGE_NOT_FETCHED.toString();
        Logger.getLogger(FacebookClient.class.getName()).log(Level.SEVERE, null, ex);
    }

    return aboutPageText;
}