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.jjtree.utilities.JConverter.java

public static JSONObject convert(HttpServletRequest request) throws IOException {
    StringBuilder sb = new StringBuilder();
    BufferedReader reader = request.getReader();
    try {//from w w w .  j  a v  a  2  s.co m
        String line;
        while ((line = reader.readLine()) != null) {
            sb.append(line).append('\n');
        }
    } finally {
        reader.close();
    }

    JSONObject jsonObject = null;
    try {
        jsonObject = new JSONObject(sb.toString());
    } catch (JSONException ex) {
        Logger.getLogger(JConverter.class.getName()).log(Level.SEVERE, null, ex);
    }

    return jsonObject;
}

From source file:dao.NewEntryDaoTest.java

@AfterClass
public static void tearDownClass() {
    try {//  w w w  . j  a  va2  s  . c  o m
        File testFile = new File(System.getProperty("user.dir") + fSeparator + "MyDiaryBook" + fSeparator);
        FileUtils.deleteDirectory(testFile);
    } catch (IOException ex) {
        Logger.getLogger(NewEntryDaoTest.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:local.laer.app.newgenerator.TileBuilder.java

public static String json(Tile tile) {
    try {//  w ww  . j av  a  2s . com
        return new ObjectMapper().writeValueAsString(tile);
    } catch (JsonProcessingException ex) {
        Logger.getLogger(TileBuilder.class.getName()).log(Level.SEVERE, null, ex);
        throw new RuntimeException(ex);
    }
}

From source file:controller.NewEntryTextControllerTest.java

@AfterClass
public static void tearDownClass() {
    File file = new File(System.getProperty("user.dir") + fSeparator + "MyDiaryBook" + fSeparator);
    try {//from   ww w . j a  v a 2  s.  c om
        FileUtils.deleteDirectory(file);
    } catch (IOException ex) {
        Logger.getLogger(NewEntryTextControllerTest.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:iracing.webapi.LicenseParser.java

public static List<License> parse(String json) {
    JSONParser parser = new JSONParser();
    List<License> output = null;
    try {/*from ww  w  .java  2  s . c  om*/
        JSONArray root = (JSONArray) parser.parse(json);
        output = new ArrayList<License>();
        for (int i = 0; i < root.size(); i++) {
            JSONObject o = (JSONObject) root.get(i);
            License license = new License();
            license.setId(getInt(o, "id"));
            license.setShortName(getString(o, "shortname"));
            license.setFullName(getString(o, "name", true));
            output.add(license);
        }
    } catch (ParseException ex) {
        Logger.getLogger(LicenseParser.class.getName()).log(Level.SEVERE, null, ex);
    }
    return output;
}

From source file:javaapplication1.RTFTester.java

public static void doStuff() {
    try {//from w w w.j av a 2 s . c om
        String content = IOUtils.toString(new FileInputStream("D:\\TemplateBuilder.rtf"));
        content = content.replaceAll("TAB_NUM", "9003");
        content = content.replaceAll("FULL_NAME", " ? ?");
        content = content.replaceAll("LOGIN", "NMoldabe");
        content = content.replaceAll("ACCEPT_DATE", "2015-09-21");
        IOUtils.write(content, new FileOutputStream("D:\\result.rtf"));

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

From source file:connection.EmailSending.java

public static void sendTextEmail(String subject, String content, String recipientEmail) {
    Email email = new SimpleEmail();

    email.setHostName(MailInfor.HOST_NAME);
    email.setSmtpPort(465);//from w  w  w  . java  2s  . c  o  m
    email.setAuthenticator(new DefaultAuthenticator(MailInfor.EMAIL_SENDER, MailInfor.PASSWORD));
    email.setSSLOnConnect(true);

    try {
        email.setFrom(MailInfor.EMAIL_SENDER);
        email.setSubject(subject);
        email.setMsg(content);
        email.addTo(recipientEmail);

        email.send();
    } catch (EmailException ex) {
        Logger.getLogger(EmailSending.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:functional.testing.customerclient.util.ScreenCapturer.java

public static void takeAShot(WebDriver driver, String filename) {
    File passwordChecked = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
    File failureImageFile = new File("target/" + filename);
    try {/*w  w  w.ja va2s . c  om*/
        FileUtils.moveFile(passwordChecked, failureImageFile);
    } catch (IOException ex) {
        Logger.getLogger(RegisterTest.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:io.trivium.anystore.StoreUtils.java

public static void cleanStore() {
    Logger logger = Logger.getLogger(StoreUtils.class.getName());
    logger.info("cleaning persistence store");
    String path = Central.getProperty("basePath");
    if (!path.endsWith(File.separator))
        path += File.separator;/*www  .  ja v a2s . c  om*/
    path += "store" + File.separator;
    try {
        File f = new File(path + meta);
        if (f.exists())
            FileUtils.deleteQuietly(f);
    } catch (Exception e1) {
        logger.log(Level.SEVERE, "cleaning meta store failed", e1);
    }
    try {
        File f = new File(path + data);
        if (f.exists())
            FileUtils.deleteQuietly(f);
    } catch (Exception e1) {
        logger.log(Level.SEVERE, "cleaning data store failed", e1);
    }
    try {
        File f = new File(path + local);
        if (f.exists())
            FileUtils.deleteQuietly(f);
    } catch (Exception e1) {
        logger.log(Level.SEVERE, "cleaning local store failed", e1);
    }
}

From source file:sandeep.kb.android.remote.utils.Utils.java

public static void log(String name, String string) {
    Logger.getLogger(name).log(Level.INFO, string.toString());
}