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:de.blinkenlights.bmix.main.Daemon.java

public void init(DaemonContext arg0) throws Exception {
    int verbosity = 1;
    if (System.getProperty("debugLevel") != null) {
        verbosity = Integer.parseInt(System.getProperty("debugLevel"));
    }/*from   w ww .j  av a2s.  c  o  m*/
    Level logLevel;
    if (verbosity == 0) {
        logLevel = Level.WARNING;
    } else if (verbosity == 1) {
        logLevel = Level.INFO;
    } else if (verbosity == 2) {
        logLevel = Level.FINE;
    } else if (verbosity >= 3) {
        logLevel = Level.FINEST;
    } else {
        System.err.println("Fatal Error: Invalid log verbosity: " + verbosity);
        return;
    }
    System.err.println("Setting log level to " + logLevel);
    Logger.getLogger("").setLevel(logLevel);
    for (Handler handler : Logger.getLogger("").getHandlers()) {
        handler.setLevel(logLevel);
    }

    bmix = new BMix("bmix.xml", false);
}

From source file:com.creditcloud.ump.model.ump.utils.UmpUtils.java

public static List<UmpSeqTransaction> parseSeqTrans(String transDetail) {
    List<UmpSeqTransaction> transList = new ArrayList<>();
    if (StringUtils.isBlank(transDetail)) {
        return transList;
    }/*from ww w.j a  va2s.  co m*/
    String[] transStrArray = StringUtils.split(transDetail, '|');
    for (String transStr : transStrArray) {
        String[] fieldStrArray = transStr.split(",");
        Map<String, String> values = new HashMap<String, String>();
        for (String fieldStr : fieldStrArray) {
            String[] pair = fieldStr.split("=");
            if (pair.length != 2) {
                logger.log(Level.WARNING, "cannot parse transaction field string:" + fieldStr + ", ignore");
                continue;
            } else {
                values.put(pair[0], pair[1]);
            }
        }
        UmpSeqTransaction trans = new UmpSeqTransaction();
        trans.setAccCheckDate(values.get("acc_check_date"));
        trans.setAmount(fromCents(values.get("amount")));
        trans.setComAmt(
                values.get("com_amt") != null ? fromCents(values.get("com_amt")).setScale(2) : BigDecimal.ZERO);
        trans.setDcMark(UmpSeqCashFlow.getEnum(values.get("dc_mark")));
        trans.setTransType(UmpBusiType.getEnum(values.get("trans_type")));
        trans.setTransState(UmpSeqTransStatus.getEnum(values.get("trans_state")));
        transList.add(trans);
    }
    return transList;
}

From source file:com.github.veithen.ulog.MetaFactory.java

public static synchronized MetaFactory getInstance() {
    if (instance == null) {
        LoggerFactoryBinder binder = getLoggerFactoryBinder();
        if (binder != null) {
            String loggerFactoryClass = binder.getLoggerFactoryClassStr();
            if (loggerFactoryClass.equals("org.slf4j.helpers.NOPLoggerFactory")) {
                instance = new MetaFactory(new NoOpLogFactory(), new NOPLoggerFactory());
            } else if (loggerFactoryClass.equals("org.slf4j.impl.Log4jLoggerFactory")) {
                if (isLog4jAvailable()) {
                    instance = new MetaFactory(new Log4jLogFactory(), new Log4jLoggerFactory());
                } else {
                    logger.log(Level.WARNING, "slf4j-log4j12 detected, but log4j is not available");
                }/*from ww w  .  j a  v a  2s.c o m*/
            } else {
                instance = new MetaFactory(new SLF4JLogFactory(), binder.getLoggerFactory());
            }
        }
        if (instance == null) {
            if (isLog4jAvailable()) {
                instance = new MetaFactory(new Log4jLogFactory(), new Log4jLoggerFactory());
            } else {
                instance = new MetaFactory(new Jdk14LogFactory(), new JDK14LoggerFactory());
            }
        }
    }
    return instance;
}

From source file:net.GoTicketing.GetNecessaryCookie.java

public static void getCookie(String host, String referer, String target, Map<String, String> cookieMap) {

    try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
        HttpGet httpGet = new HttpGet(host + target);
        httpGet.setConfig(DEFAULT_PARAMS);

        String cookies = CookieMapToString(cookieMap);
        if (!cookies.equals(""))
            httpGet.setHeader("Cookie", cookies);

        httpGet.setHeader("Referer", host + referer);

        try (CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) {

            //  HttpStatusCode != 200 && != 404
            if (httpResponse.getStatusLine().getStatusCode() != HttpStatus.SC_OK
                    && httpResponse.getStatusLine().getStatusCode() != HttpStatus.SC_NOT_FOUND) {
                String ErrorCode = "Response Status : " + httpResponse.getStatusLine().getStatusCode();
                throw new IOException(ErrorCode);
            }/*w  ww.  j a v a2 s . c o  m*/

            try (BufferedInputStream buff = new BufferedInputStream(httpResponse.getEntity().getContent())) {
                String hstr;
                for (Header header : httpResponse.getHeaders("Set-Cookie")) {
                    hstr = header.getValue().split(";")[0];
                    cookieMap.put(hstr.split("=", 2)[0], hstr.split("=", 2)[1]);
                }
            }
        }
    } catch (IOException ex) {
        logger.log(Level.WARNING, "Get cookie from {0} failed in exception : {1}", new Object[] { target, ex });
    }
}

From source file:jp.zippyzip.Zip.java

/**
 * JSON ???// w w  w .j av a 2s . c  om
 * 
 * @param json JSON
 * @return 
 */
public static Zip fromJson(String json) {

    Zip ret = null;

    try {

        JSONObject jo = new JSONObject(json);

        ret = new Zip(jo.optString("code", ""), jo.optString("x0402", ""), jo.optString("add1", ""),
                jo.optString("add2", ""), jo.optString("corp", ""), jo.optString("add1Yomi", ""),
                jo.optString("add2Yomi", ""), jo.optString("corpYomi", ""), jo.optString("note", ""));

    } catch (JSONException e) {
        log.log(Level.WARNING, "", e);
    }

    return ret;
}

From source file:cz.incad.kramerius.k5indexer.KrameriusPDFDocument.java

private void setDocument() throws Exception {
    try {// w  w w. j  a v  a  2s  .  com
        closeDocument();
        PDDocument pdDocument = PDDocument.load(stream,
                KConfiguration.getInstance().getConfiguration().getString("convert.pdfPassword"));
    } catch (Exception ex) {
        closeDocument();
        logger.log(Level.WARNING, "Cannot parse PDF document", ex);
    }

}

From source file:net.daboross.bukkitdev.skywars.util.CrossVersion.java

/**
 * Supports Bukkit earlier than... 1.8?/*  w  ww  .  j  a v a 2 s .c  om*/
 */
public static Collection<? extends Player> getOnlinePlayers(Server s) {
    try {
        return s.getOnlinePlayers();
    } catch (NoSuchMethodError ignored) {
        Class<? extends Server> theClass = s.getClass();
        try {
            for (Method method : theClass.getMethods()) {
                if ("getOnlinePlayers".equals(method.getName()) && method.getParameterTypes().length == 0
                        && method.getReturnType().isArray()) {
                    return Arrays.asList((Player[]) method.invoke(s));
                }
            }
        } catch (SecurityException | IllegalAccessException | IllegalArgumentException
                | InvocationTargetException ex) {
            SkyStatic.getLogger().log(Level.WARNING,
                    "Couldn't use fallback .getOnlinePlayers method of Server! Acting as if there are no online players!!",
                    ex);
        }
        SkyStatic.getLogger().log(Level.WARNING,
                "Couldn't find old fallback .getOnlinePlayers method of Server! Acting as if there are no online players!!");
    }
    return Collections.emptyList();
}

From source file:edu.usu.sdl.openstorefront.service.manager.SolrManager.java

public static void init() {
    String url = PropertiesManager.getValue(PropertiesManager.KEY_SOLR_URL);
    if (StringUtils.isNotBlank(url)) {
        log.log(Level.INFO, MessageFormat.format("Connecting to Solr at {0}", url));
        solrServer = new HttpSolrServer(url);

    } else {/*  w  w w.j  a v a 2  s.c  om*/
        log.log(Level.WARNING, "Solr property (" + PropertiesManager.KEY_SOLR_URL
                + ") is not set in openstorefront.properties. Search service unavailible. Using Mock");
        solrServer = new SolrServer() {

            @Override
            public NamedList<Object> request(SolrRequest request) throws SolrServerException, IOException {
                NamedList<Object> results = new NamedList<>();
                log.log(Level.INFO, "Mock Solr recieved request: " + request);
                return results;
            }

            @Override
            public void shutdown() {
                //do nothing
            }
        };
    }
}

From source file:de.mg.stock.server.util.HttpUtil.java

public String get(String urlStr) {

    try {//from  www  . ja va 2  s .c  o m
        URL url = new URL(urlStr);

        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setRequestMethod("GET");

        if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
            InputStream response = connection.getInputStream();
            return IOUtils.toString(response);
        } else {
            log.log(Level.WARNING, "retrieving " + urlStr + " returned " + connection.getResponseCode());
            return null;
        }
    } catch (IOException e) {
        log.log(Level.WARNING, "retrieving " + urlStr, e);
        return null;
    }
}

From source file:ch.gbrain.gwtstorage.test.model.TestItem.java

@Override
public JSONValue toJson() {
    try {// w  ww . ja v a 2  s  .c  o  m
        TestItemCodec codec = GWT.create(TestItemCodec.class);
        return codec.encode(this);
    } catch (Exception ex) {
        Logger.getGlobal().log(Level.WARNING, "Failure converting to Json", ex);
    }
    return null;
}