Example usage for java.util.logging Level WARNING

List of usage examples for java.util.logging Level WARNING

Introduction

In this page you can find the example usage for java.util.logging Level WARNING.

Prototype

Level WARNING

To view the source code for java.util.logging Level WARNING.

Click Source Link

Document

WARNING is a message level indicating a potential problem.

Usage

From source file:com.p000ison.dev.copybooks.util.Helper.java

public static int getAmontFromSign(char[] chars) {
    StringBuilder amountString = new StringBuilder();

    for (int i = chars.length - 1; i > 0; i--) {
        if (chars[i] == ':') {
            break;
        }//from   w  w w.j a v a  2s.c  om

        amountString.append(chars[i]);
    }

    int amount = -1;

    try {
        amount = Integer.parseInt(amountString.toString());
    } catch (NumberFormatException e) {
        CopyBooks.debug(Level.WARNING, ChatColor.DARK_RED + "Failed at parsing sign!");
    }

    return amount;
}

From source file:com.bc.appbase.ui.dialog.SendReportAction.java

@Override
public String execute(Object message, Throwable t) {

    final Content<String> content = new StackTraceTextContent(message == null ? null : message.toString(), t);

    email.setContent(content.getContent(), content.getContentType());

    try {//from  w  w  w  .j  a va  2 s . co  m
        return email.send();
    } catch (EmailException e) {
        logger.log(Level.WARNING, "Error sending email for message: " + message + ", and exception: " + t, e);
        return null;
    }
}

From source file:net.bluemix.connectors.core.creator.CloudantInstanceCreator.java

@Override
public CouchDbInstance create(CloudantServiceInfo serviceInfo, ServiceConnectorConfig serviceConnectorConfig) {
    HttpClient httpClient;//from w  ww.ja  v a 2  s  .  co m
    try {
        httpClient = new StdHttpClient.Builder().url(serviceInfo.getUrl()).build();
        return new StdCouchDbInstance(httpClient);
    } catch (MalformedURLException e) {
        LOG.logp(Level.WARNING, CloudantInstanceCreator.class.getName(), "create", "Error parsing URL", e);
        return null;
    }
}

From source file:com.nebel_tv.content.utils.ConnectionUtils.java

/**
 *
 * @param url//from  w ww .  ja va2s.c  o  m
 * @return
 * @throws Exception
 */
public static String getResponseAsString(String url) throws Exception {
    if (ids.empty()) {
        init();
    }
    String developerId = ids.pop();

    try {
        url = url + "&Developerid=" + developerId;
        String result = IOUtils.toString(new URL(url));

        ids.push(developerId);
        return result;
    } catch (MalformedURLException ex) {
        Logger.getLogger(ConnectionUtils.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(ConnectionUtils.class.getName()).log(Level.WARNING, null, ex);
    }
    return null;
}

From source file:br.com.valecard.listeners.SendMailListener.java

@Override
public void onApplicationEvent(SendMailEvent event) {
    MimeMessage mm = mailSender.createMimeMessage();
    final String property = event.getProperty();
    try {//from  w  ww. ja v a  2s  .c  o m
        mm.setRecipients(Message.RecipientType.TO, property);
        mm.setText(property);
        //            mm.addHeader(XMC_TRACK, track);
        //            mm.addHeader(XMC_TEMPLATE, property);
        //            mm.addHeader(XMC_MERGE_VARS, mergeVars);
    } catch (MessagingException ex) {
        LOG.log(Level.WARNING, ex.getMessage(), ex);
    }
    try {
        mailSender.send(mm);
    } catch (MailException ex) {
        LOG.log(Level.WARNING, ex.getMessage(), ex);
    }
}

From source file:com.subgraph.vega.internal.http.proxy.ConnectionTask.java

@Override
public void run() {
    try {// ww  w  .j a v  a2 s. co  m
        processingLoop();
    } catch (ConnectionClosedException e) {
        logger.info("Client closed connection to proxy");
    } catch (IOException e) {
        logger.log(Level.WARNING, "IOException processing client request in proxy", e);
    } catch (HttpException e) {
        logger.log(Level.WARNING, "HTTP protocol error processing client request in proxy", e);
    } catch (Exception e) {
        logger.log(Level.WARNING, "Unexpected exception processing client request in proxy", e);
    } finally {
        proxy.notifyClose(this);
        if (connection.isOpen()) {
            try {
                connection.shutdown();
            } catch (IOException e) {
            }
        }
    }
}

From source file:it_minds.dk.eindberetningmobil_android.server.SafeJsonHelper.java

@Override
public JSONObject put(String name, Object value) {
    try {/*from   www . ja  va2s . com*/
        return super.put(name, value);
    } catch (JSONException e) {
        Logger.getLogger("SafeJsonObject").log(Level.WARNING, "", e);
        return null;
    }
}

From source file:cz.cuni.mff.d3s.tools.perfdoc.server.measuring.statistics.Statistics.java

/**
 * Creates new instance of Statistics containing values from the given
 * parameter. The parameter is in format: {value1, ..., valueN} - as stored
 * in database//from  w w  w  . ja va 2  s. c o  m
 *
 * @param values
 */
public Statistics(String values) {
    String[] items = values.substring(1, values.length() - 1).split(",");
    for (String item : items) {
        try {
            long value = Long.parseLong(item);
            addResult(value);
        } catch (NumberFormatException e) {
            log.log(Level.WARNING, "There was a not-long number passed to Statistics.");
        }
    }
}

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

private boolean askTwitterForUser(String twitterId) {
    try {/*from ww  w  .j a  v  a 2 s.  c  o  m*/
        twitter.showUser(twitterId);

        return true;
    } catch (TwitterException e) {
        if (logger.isLoggable(Level.WARNING)) {
            logger.warning(new StringBuilder().append("Twitter failed: ").append(e.getMessage()).toString());
        }

        return false;
    }
}

From source file:com.twitter.heron.common.utils.logging.LoggingHelper.java

/**
 * Init java util logging/*from  w  w w  .  j a  v  a 2s .  c o m*/
 *
 * @param level the Level of message to log
 * @param isRedirectStdOutErr whether we redirect std out&amp;err
 * @param format the format to log
 */
public static void loggerInit(Level level, boolean isRedirectStdOutErr, String format) throws IOException {
    // Set the java util logging format
    setLoggingFormat(format);

    // Configure the root logger and its handlers so that all the
    // derived loggers will inherit the properties
    Logger rootLogger = Logger.getLogger("");
    for (Handler handler : rootLogger.getHandlers()) {
        handler.setLevel(level);
    }

    rootLogger.setLevel(level);

    if (rootLogger.getLevel().intValue() < Level.WARNING.intValue()) {
        // zookeeper logging scares me. if people want this, we can patch to config-drive this
        Logger.getLogger("org.apache.zookeeper").setLevel(Level.WARNING);
    }

    // setting logging for http client to be error level
    System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
    System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "ERROR");
    System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http", "ERROR");
    System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.headers", "ERROR");

    if (isRedirectStdOutErr) {

        // Remove ConsoleHandler if present, to avoid StackOverflowError.
        // ConsoleHandler writes to System.err and since we are redirecting
        // System.err to Logger, it results in an infinite loop.
        for (Handler handler : rootLogger.getHandlers()) {
            if (handler instanceof ConsoleHandler) {
                rootLogger.removeHandler(handler);
            }
        }

        // now rebind stdout/stderr to logger
        Logger logger;
        LoggingOutputStream los;

        logger = Logger.getLogger("stdout");
        los = new LoggingOutputStream(logger, StdOutErrLevel.STDOUT);
        System.setOut(new PrintStream(los, true));

        logger = Logger.getLogger("stderr");
        los = new LoggingOutputStream(logger, StdOutErrLevel.STDERR);
        System.setErr(new PrintStream(los, true));
    }
}