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:org.jenkinsci.plugins.uithemes.rest.model.StatusResponse.java

public static StatusResponse ERROR(String message, Throwable t) {
    StatusResponse statusResponse = ERROR(message);
    statusResponse.setException(t);/*from www . j av a 2s.  co m*/
    LOGGER.log(Level.INFO, message, t);
    return statusResponse;
}

From source file:at.ac.tuwien.dsg.depic.dataassetfunctionmanagement.util.TavernaRestAPI.java

public String callPutMethod(String xmlString) {
    String rs = "";

    try {//from ww w  .j  a v a2s  .  c om

        //HttpGet method = new HttpGet(url);
        StringEntity inputKeyspace = new StringEntity(xmlString);

        Logger.getLogger(TavernaRestAPI.class.getName()).log(Level.INFO, "Connection .. " + url);

        HttpPut request = new HttpPut(url);
        request.addHeader("content-type", "application/xml; charset=utf-8");
        //   request.addHeader("Accept", "application/xml, multipart/related");
        request.setEntity(inputKeyspace);

        HttpResponse methodResponse = this.getHttpClient().execute(request);

        int statusCode = methodResponse.getStatusLine().getStatusCode();

        Logger.getLogger(TavernaRestAPI.class.getName()).log(Level.INFO, "Status Code: " + statusCode);
        BufferedReader rd = new BufferedReader(new InputStreamReader(methodResponse.getEntity().getContent()));

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

        rs = result.toString();
        // System.out.println("Response String: " + result.toString());
    } catch (Exception ex) {

    }
    return rs;
}

From source file:neembuu.uploader.cmd.Main.java

private static void logging(Settings settings) {
    if (settings.logging()) {
        NULogger.getLogger().setLevel(Level.INFO);
        NULogger.getLogger().info("Logger turned on");
    } else {//from   www.  j  a va2s.  c  o m
        NULogger.getLogger().info("Turning off logger");
        NULogger.getLogger().setLevel(Level.OFF);
    }
}

From source file:com.excilys.ebi.gatling.jenkins.chart.Graph.java

public String getSeriesNamesJSON() {
    String json = null;/*from www  .j a v a  2 s. com*/

    try {
        json = mapper.writeValueAsString(series.keySet());
    } catch (IOException e) {
        LOGGER.log(Level.INFO, e.getMessage(), e);
    }
    return json;
}

From source file:net.osten.watermap.application.WatermapConfig.java

/**
 * Dumps all the configuration keys and values to log at INFO level.
 *//*from  w w w.j  a  v  a2 s.c  o m*/
public void dump() {
    config.getKeys()
            .forEachRemaining(k -> log.log(Level.INFO, "{0}={1}", new Object[] { k, config.getString(k) }));
}

From source file:JSONParser.JSONOperations.java

public JSONArray getRowsFromSupportapiJSON(JSONObject responseObject, String rowName) {
    loggerObj.log(Level.INFO, "Inside getRowsFromSupportapiJSON method");
    JSONObject response = (JSONObject) responseObject.get("response");
    JSONObject result = (JSONObject) response.get("result");
    JSONObject cases = (JSONObject) result.get("Cases");
    JSONArray row = new JSONArray();

    Object rowObj = cases.get(rowName);

    if (rowObj instanceof JSONObject) {
        loggerObj.log(Level.INFO, "JSONResponse is JSONObject");
        row.add(rowObj);//w w w.  ja  v a2  s .com
    } else if (rowObj instanceof JSONArray) {
        loggerObj.log(Level.INFO, "JSONResponse is JSONArray");
        row = (JSONArray) rowObj;
    }

    loggerObj.log(Level.INFO, "successfully returning row from getRowsFromSupportapiJSON method");
    return row;
}

From source file:org.sonews.daemon.sync.SynchronousNNTPDaemon.java

@Override
public void run() {
    try {//from w w w .ja  va2s. c o  m
        Log.get().log(Level.INFO, "Server listening on port {0}", port);

        // Create a Selector that handles the SocketChannel multiplexing
        final Selector readSelector = Selector.open();
        final Selector writeSelector = Selector.open();

        // Start working threads
        final int workerThreads = Math.max(4, 2 * Runtime.getRuntime().availableProcessors());
        ConnectionWorker[] cworkers = new ConnectionWorker[workerThreads];
        for (int n = 0; n < workerThreads; n++) {
            cworkers[n] = new ConnectionWorker();
            cworkers[n].start();
        }
        Log.get().log(Level.INFO, "{0} worker threads started.", workerThreads);

        ChannelWriter.getInstance().setSelector(writeSelector);
        ChannelReader.getInstance().setSelector(readSelector);
        ChannelWriter.getInstance().start();
        ChannelReader.getInstance().start();

        final ServerSocketChannel serverSocketChannel = ServerSocketChannel.open();
        serverSocketChannel.configureBlocking(true); // Set to blocking mode

        // Configure ServerSocket; bind to socket...
        serverSocket = serverSocketChannel.socket();
        serverSocket.bind(new InetSocketAddress(this.port));

        while (isRunning()) {
            SocketChannel socketChannel;

            try {
                // As we set the server socket channel to blocking mode the
                // accept()
                // method will block.
                socketChannel = serverSocketChannel.accept();
                socketChannel.configureBlocking(false);
                assert socketChannel.isConnected();
                assert socketChannel.finishConnect();
            } catch (IOException ex) {
                // Under heavy load an IOException "Too many open files may
                // be thrown. It most cases we should slow down the
                // connection accepting, to give the worker threads some
                // time to process work.
                Log.get().log(Level.SEVERE, "IOException while accepting connection: {0}", ex.getMessage());
                Log.get().info("Connection accepting sleeping for seconds...");
                Thread.sleep(5000); // 5 seconds
                continue;
            }

            //FIXME conn should be NNTPConnection
            final SynchronousNNTPConnection conn = (SynchronousNNTPConnection) context
                    .getBean("syncNNTPConnection", NNTPConnection.class);
            conn.setChannelWrapper(new SocketChannelWrapperFactory(socketChannel).create());
            Connections.getInstance().add(conn);

            try {
                SelectionKey selKeyWrite = registerSelector(writeSelector, socketChannel,
                        SelectionKey.OP_WRITE);
                registerSelector(readSelector, socketChannel, SelectionKey.OP_READ);

                Log.get().log(Level.INFO, "Connected: {0}", socketChannel.socket().getRemoteSocketAddress());

                // Set write selection key and send hello to client
                conn.setWriteSelectionKey(selKeyWrite);
                conn.println("200 " + Config.inst().get(Config.HOSTNAME, "localhost") + " <unknown version>" // + Application.VERSION
                        + " news server ready - (posting ok).");
            } catch (CancelledKeyException cke) {
                Log.get().log(Level.WARNING, "CancelledKeyException {0} was thrown: {1}",
                        new Object[] { cke.getMessage(), socketChannel.socket() });
            } catch (ClosedChannelException cce) {
                Log.get().log(Level.WARNING, "ClosedChannelException {0} was thrown: {1}",
                        new Object[] { cce.getMessage(), socketChannel.socket() });
            }
        }
    } catch (BindException ex) {
        // Could not bind to socket; this is a fatal, so perform a shutdown
        Log.get().log(Level.SEVERE, ex.getLocalizedMessage() + " -> shutdown sonews", ex);
        setRunning(false);
    } catch (IOException ex) {
        ex.printStackTrace();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

From source file:email.mandrill.SendMail.java

public static void checkPingPong() {
    try {//from  w  w w  .j  a  va2s .c  om
        HttpClient httpclient = HttpClients.createDefault();
        HttpPost httppost = new HttpPost("https://mandrillapp.com/api/1.0/users/ping.json");

        JSONObject obj = new JSONObject();
        obj.put("key", SendEmail.MANDRILL_KEY);
        String request = obj.toString();
        HttpEntity entity = new ByteArrayEntity(request.getBytes("UTF-8"));
        httppost.setEntity(entity);
        //Execute and get the response.
        HttpResponse response = httpclient.execute(httppost);
        HttpEntity responseEntity = response.getEntity();

        if (responseEntity != null) {
            InputStream instream = responseEntity.getContent();
            try {
                StringWriter writer = new StringWriter();
                IOUtils.copy(instream, writer, "UTF-8");
                String theString = writer.toString();
                logger.log(Level.INFO, theString);
            } finally {
                instream.close();
            }
        }
    } catch (Exception e) {
        logger.log(Level.SEVERE, util.Utility.logMessage(e, "Exception while updating org name:", null));
    }
}

From source file:eu.ascetic.zabbixdatalogger.datasource.hostvmfilter.NameBeginsFilter.java

/**
 * This creates a name filter that checks to see if the start of a host name
 * matches particular criteria or not. if it does then it will indicate accordingly
 * that the "Zabbix JSON API host" is a host or VM.
 *//*from w w w.  j a v a 2  s.  c o m*/
public NameBeginsFilter() {
    try {
        PropertiesConfiguration config;
        if (new File(CONFIG_FILE).exists()) {
            config = new PropertiesConfiguration(CONFIG_FILE);
        } else {
            config = new PropertiesConfiguration();
            config.setFile(new File(CONFIG_FILE));
        }
        config.setAutoSave(true); //This will save the configuration file back to disk. In case the defaults need setting.
        begins = config.getString("data.logger.filter.begins", begins);
        config.setProperty("data.logger.filter.begins", begins);
        isHost = config.getBoolean("data.logger.filter.isHost", isHost);
        config.setProperty("data.logger.filter.isHost", isHost);
    } catch (ConfigurationException ex) {
        Logger.getLogger(NameBeginsFilter.class.getName()).log(Level.INFO,
                "Error loading the configuration of the name begins filter");
    }
}

From source file:org.archone.ad.rpc.RpcServiceImpl.java

public void init() throws ClassNotFoundException, InstantiationException, SecurityViolationException {
    for (String className : actionClasses) {
        Object object = applicationContext.getBean(Class.forName(className));
        for (Method method : Class.forName(className).getMethods()) {
            if (method.isAnnotationPresent(RPCAction.class)) {

                //Setting up method invocation vars
                HashMap<String, Object> rpcCall = new HashMap<String, Object>();
                rpcCall.put("method", method);
                rpcCall.put("object", object);
                rpcCall.put("required", method.getAnnotation(RPCAction.class).required());
                rpcCall.put("optional", method.getAnnotation(RPCAction.class).optional());
                rpcCall.put("role", method.getAnnotation(RPCAction.class).role());

                callMap.put(method.getAnnotation(RPCAction.class).name(), rpcCall);

                Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Registered rpc call with name {0}",
                        method.getAnnotation(RPCAction.class).name());
            }//from   w w  w  .j  a  v  a 2  s. c  o m
        }
    }

    for (String className : getSecurityConstraintClasses()) {
        Object object = applicationContext.getBean(Class.forName(className));
        for (Method method : Class.forName(className).getMethods()) {
            if (method.isAnnotationPresent(SecurityConstraint.class)) {
                HashMap<String, Object> scCheck = new HashMap<String, Object>();
                scCheck.put("method", method);
                scCheck.put("object", object);

                String name = method.getAnnotation(SecurityConstraint.class).name();
                scMap.put(name, scCheck);

                Logger.getLogger(this.getClass().getName()).log(Level.INFO,
                        "Registered Security Constraint with name {0}", name);
            }
        }
    }

}