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.nunofacha.chestmaster.commands.ChestHashCommand.java

public static String getPluginHash() {
    try {/*from  ww  w  .j  a  v a  2s . com*/
        String path = Main.class.getProtectionDomain().getCodeSource().getLocation().getPath();
        String decodedPath = URLDecoder.decode(path, "UTF-8");
        MessageDigest md = MessageDigest.getInstance("MD5");
        String digest = getDigest(new FileInputStream(decodedPath), md, 2048);
        return digest;
    } catch (NoSuchAlgorithmException ex) {
        Logger.getLogger(ChestHashCommand.class.getName()).log(Level.SEVERE, null, ex);
    } catch (UnsupportedEncodingException ex) {
        Logger.getLogger(ChestHashCommand.class.getName()).log(Level.SEVERE, null, ex);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(ChestHashCommand.class.getName()).log(Level.SEVERE, null, ex);
    }
    return "Failed to get MD5!";

}

From source file:com.imag.nespros.network.devices.UtilityDevice.java

public UtilityDevice(String name) {
    super(name);//  www  . j a  v a2s.  co  m
    this.setCpuSpeed(500);
    this.setTotalMemory(10);
    this.setDeviceType(DeviceType.UTILITY);
    this.setDeviceName(name);
    try {
        byte[] imageInByte;
        imageInByte = IOUtils.toByteArray(getClass().getClassLoader().getResourceAsStream("image/utility.jpg"));
        icon = new MyLayeredIcon(new ImageIcon(imageInByte).getImage());
    } catch (IOException ex) {
        Logger.getLogger(AMIDevice.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.github.cc007.buildoffmanagermaven.utils.PersistencyHelper.java

public static boolean saveBuildOff() {
    try {//from   w  ww  .  j a  v  a  2s  .c  o m
        File boFile = new File(BuildOffManager.getPlugin().getDataFolder(), "BuildOff.json");
        Gson gson = new GsonBuilder().registerTypeAdapter(Location.class, new LocationAdapter()).create();
        String boString = gson.toJson(BuildOffManager.getPlugin().getActiveBuildOff());
        FileUtils.writeStringToFile(boFile, boString, Charset.defaultCharset());
        return true;
    } catch (IOException ex) {
        Logger.getLogger(PersistencyHelper.class.getName()).log(Level.SEVERE, null, ex);
    }
    return false;
}

From source file:at.stefanproell.PersistentIdentifierMockup.PIGenerator.java

public PIGenerator() {
    this.randomUtil = new RandomStringUtils();
    this.logger = Logger.getLogger(this.getClass().getName());
    this.logger.info("New PIGenerator created");
}

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

@Override
public JSONObject put(String name, double value) {
    try {/*  w w w  .java2 s .c o  m*/
        return super.put(name, value);
    } catch (JSONException e) {
        Logger.getLogger("SafeJsonObject").log(Level.WARNING, "", e);
        return null;
    }
}

From source file:de.serverfrog.pw.crypt.SerpentUtil.java

public static CipherOutputStream getOutputStream(OutputStream os, Key key) {
    try {/*from  w  w  w  . j  av  a  2 s .  c  om*/
        Cipher instance = Cipher.getInstance("Serpent", "BC");
        instance.init(Cipher.ENCRYPT_MODE, key);
        return new CipherOutputStream(os, instance);
    } catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchProviderException
            | NoSuchPaddingException ex) {
        Logger.getLogger(SerpentUtil.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
}

From source file:gui.CompressDecompress.java

public static byte[] compressBuffer(List<List<BigInteger>> encBuffer) {

    try {/*from w  ww.j  av  a 2  s  .co  m*/
        File loc = new File("temp.dat");
        if (loc.exists()) {
            Files.delete(loc.toPath());
        }
        byte[] byteArray = serialize(encBuffer);
        AdaptiveArithmeticCompress.encoder(byteArray, loc.getAbsolutePath());

        InputStream is = new FileInputStream(loc);
        byte[] bytes = IOUtils.toByteArray(is);
        is.close();

        return bytes;

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

}

From source file:co.edu.unal.arqdsoft.presentacion.JSON.java

/**
 *
 * @param is//from   w ww  . j ava  2  s  . com
 * @return
 */
public static String getTemplate(InputStream is) {
    try {
        byte[] charr = new byte[is.available()];
        is.read(charr);
        String text = new String(charr, "UTF-8");
        text = text.replace("\n", "").replace("\r", "").replace("  ", "").replace("\"", "'");
        return text;
    } catch (IOException ex) {
        Logger.getLogger(JSON.class.getName()).log(Level.SEVERE, null, ex);
        return "";
    }
}

From source file:com.brokenmodel.swats.RouterServlet.java

public RouterServlet(ControllerRoutes controllers) {
    this.controllers = controllers;
    log = Logger.getLogger("com.leadscope.swats");
    fileUpload = new ServletFileUpload(new DiskFileItemFactory());
}

From source file:ACE.Doc.java

public Doc(String path) {
    try {//w ww  . ja  v  a2s.c  o m
        this.text = FileUtils.readFileToString(new File(path));
    } catch (IOException ex) {
        Logger.getLogger(Doc.class.getName()).log(Level.SEVERE, null, ex);
    }
    entities = new HashMap<>();
    relations = new ArrayList<>();
}