Example usage for java.util.logging Logger getLogger

List of usage examples for java.util.logging Logger getLogger

Introduction

In this page you can find the example usage for java.util.logging Logger getLogger.

Prototype




@CallerSensitive
public static Logger getLogger(String name) 

Source Link

Document

Find or create a logger for a named subsystem.

Usage

From source file:com._8x8.data.repository.BroadcastRepository.java

@Override
public Boolean sendBroadcastMsg(String msg, String RegisterId, GCM gcm) {

    String jsonStr = "[  " + " {" + "   \"data\": {" + "       \"title\": \"Test Title\","
            + "       \"body\": \"" + msg + "\"" + "   }," + " \"to\": \"" + RegisterId + "\"" + " }]";

    try {/*from  ww w.ja  v  a  2  s . c  o  m*/
        JSONArray array = new JSONArray(jsonStr);
        this.sendGCMHTTPData(array.getJSONObject(0), gcm);
    } catch (JSONException ex) {
        Logger.getLogger(BroadcastRepository.class.getName()).log(Level.SEVERE, null, ex);
    }
    return true;
}

From source file:com.javabean.tools.FileHelper.java

public FileHelper(String relativeDirectoryPath, FileItem fileItem) {
    try {//from w  w  w. j a v a2  s. c  o m
        this.internalName = SystemInfo.GetUniqueId();
    } catch (Exception ex) {
        Logger.getLogger(FileHelper.class.getName()).log(Level.SEVERE, null, ex);
    }
    this.relativeDirectoryPath = relativeDirectoryPath;
    this.fileItem = fileItem;
}

From source file:com.bluepandora.therap.donatelife.service.CheckService.java

public static boolean isValidUser(String mobileNumber, String hashKey, DatabaseService dbService) {

    String query = GetQuery.getValidUserQuery(mobileNumber, hashKey);
    // Debug.debugLog("VALID USER QUERY: ", query);
    ResultSet result = dbService.getResultSet(query);
    boolean USER_VALID = false;
    try {//from  www .j  a v  a 2  s  .  c o m
        while (result.next()) {
            USER_VALID = true;
        }
    } catch (SQLException error) {
        Logger.getLogger(CheckService.class.getName()).log(Level.SEVERE, null, error);
    }
    return USER_VALID;
}

From source file:Gestores.GestorHash.java

public String md5(String plaintext) {
    String hashtext = "";
    try {//from   ww w  . j ava  2s.  c  o  m
        MessageDigest m = MessageDigest.getInstance("MD5");
        m.reset();
        m.update(plaintext.getBytes());
        byte[] digest = m.digest();
        BigInteger bigInt = new BigInteger(1, digest);
        hashtext = bigInt.toString(16);
        // Now we need to zero pad it if you actually want the full 32 chars.
        while (hashtext.length() < 32) {
            hashtext = "0" + hashtext;
        }
    } catch (NoSuchAlgorithmException ex) {
        Logger.getLogger(GestorHash.class.getName()).log(Level.SEVERE, null, ex);
    }
    return hashtext;
}

From source file:br.gov.sc.fatma.resourcemanager.commands.SiteCheckIfUPCommand.java

@Override
public Status execute() {
    Logger.getLogger(SiteCheckIfUPCommand.class.getName()).log(Level.FINE,
            "-------- " + _site.getPath() + " Connection Testing ------");
    Status result;/*from w  ww  .java2  s .  c o m*/
    CloseableHttpClient httpclient = HttpClients.createDefault();
    try {
        HttpGet httpget = new HttpGet(_site);
        Logger.getLogger(SiteCheckIfUPCommand.class.getName()).log(Level.INFO,
                "Executing request " + httpget.getRequestLine());

        ResponseHandler<String> responseHandler = new BasicResponseHandler() {
            @Override
            public String handleResponse(final HttpResponse response)
                    throws ClientProtocolException, IOException {
                int status = response.getStatusLine().getStatusCode();
                if (status >= 200 && status < 300) {
                    return "200";
                } else {
                    return String.valueOf(status);
                }
            }
        };
        String responseBody = httpclient.execute(httpget, responseHandler);
        result = new Status(responseBody.equals("200"), "", Integer.valueOf(responseBody));
    } catch (IOException ex) {
        Logger.getLogger(SiteCheckIfUPCommand.class.getName()).log(Level.WARNING, ex.getMessage(), ex);
        ex.printStackTrace();
        result = new Status(false, ex.getMessage(), -1);
    } finally {
        try {
            httpclient.close();
        } catch (IOException ex) {
        }
    }

    return result;
}

From source file:at.ac.tuwien.dsg.cloudlyra.utils.IOUtils.java

public static void cleanTempData() {
    String tomcatTempFolder = System.getProperty("java.io.tmpdir");
    File dir = new File(tomcatTempFolder);
    try {/*from www . j a v  a  2s  .co m*/
        FileUtils.cleanDirectory(dir);
    } catch (IOException ex) {
        Logger.getLogger(IOUtils.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:com.nuance.expertassistant.ContentExtractor.java

public static void extract(String URL) {
    try {//from ww  w .  j  a  v a2  s. c om
        final Document doc = Jsoup.connect(URL).timeout(0).get();
        extract(doc);
    } catch (final IOException ex) {
        Logger.getLogger(ContentExtractor.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:alexaactions.SmartThingsTemperatureDevices.java

SmartThingsTemperatureDevices(SmartThingsAgent sa) {
    agent = sa;//from w  ww.j  a  va 2  s  .c  o  m
    parser = new JSONParser();
    path = "temps";
    String jsonScale = agent.get(path + "/units");
    Object obj = null;
    JSONObject jobj = null;

    try {
        obj = (Object) parser.parse(jsonScale);
        jobj = (JSONObject) obj;
    } catch (ParseException ex) {
        Logger.getLogger(SmartThingsTemperatureDevices.class.getName()).log(Level.SEVERE, null, ex);
        System.out.println("defaulting to F scale");
        tempScale = "F";
    }
    tempScale = (String) jobj.get("units");
}

From source file:monitoring.Monitoring.java

public boolean updateContainer(int container, int ram, int cpu, int disk) {
    try {//  w  w w  .  j a  v a2 s .c o  m
        Process execute;
        String command;
        if (cpu == 0) {
            command = "/root/scripts/update_container.sh " + container + " " + ram;

        } else {
            command = "/root/scripts/update_container.sh " + container + " " + ram + " " + cpu;
        }

        execute = Runtime.getRuntime().exec(command);

    } catch (IOException ex) {
        Logger.getLogger(Monitoring.class.getName()).log(Level.SEVERE, null, ex);
    }

    return true;
}

From source file:com.epam.spring.core.logger.FileEventLogger.java

@Override
public void logEvent(Event event) {
    try {/*from   w  ww.j  a  va 2s.  co  m*/
        FileUtils.writeStringToFile(file, event.toString(), true);
    } catch (IOException ex) {
        Logger.getLogger(FileEventLogger.class.getName()).log(Level.SEVERE, null, ex);
    }
}