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:maltcms.ui.fileHandles.properties.tools.ModelBuilder.java

public static WidgetTableModel getModel(Configuration properties, Object bean) {

    Vector<String> header = new Vector<>();
    header.add("Key");
    header.add("Value");
    Logger.getLogger(ModelBuilder.class.getName()).log(Level.INFO, "properties: {0}", properties);

    return new WidgetTableModel(header, PropertyLoader.asHash(properties), bean);
}

From source file:com.cyphermessenger.utils.Utils.java

public static byte[] sha256(byte[] s) {
    try {//from   w  w  w.j a v a 2s.  co m
        return MessageDigest.getInstance("SHA-256").digest(s);
    } catch (NoSuchAlgorithmException ex) {
        Logger.getLogger(Utils.class.getName()).log(Level.SEVERE, null, ex);
        return null;
    }
}

From source file:com.krj.karbon.GetPlayerSummaries.java

/**
 *
 * @param user/*from www.j  av a  2 s. com*/
 * @param steamId
 * @return
 */
public static SteamAccount retrieve(SteamAccount user, String steamId) {
    try {

        //setup the steamId
        String id = "&steamids=" + steamId;

        //get the map of player info from the steamAPI
        List<Map> playerMaps = getPlayerMaps(id);

        //set the info from the map to the player
        if (playerMaps != null) {
            for (Map map : playerMaps) {
                user = getUserInfo(user, map);
            }
        }
    } catch (IOException ex) {
        Logger.getLogger(GetOwnedGames.class.getName()).log(Level.SEVERE, null, ex);
    }

    return user;
}

From source file:com.inkubator.hrm.util.HrmUserInfoUtil.java

public static String getRealName() {
    HrmUserService hrmUserService = (HrmUserService) ServiceWebUtil.getService("hrmUserService");
    String hrmUserName = getUserName();
    try {/*from ww  w  .j  ava  2s .  c  om*/
        return hrmUserService.getByUserIdOrEmail(hrmUserName).getRealName();
    } catch (Exception ex) {
        Logger.getLogger(HrmUserInfoUtil.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
}

From source file:local.Statistics.LessSellRepuesto.java

/**
 * @param args the command line arguments
 *///from ww w .  j  a va  2  s . c om
public static void repuestosMenosVendidos() {
    Graficas_DAO gr = new Graficas_DAO();
    //obtencion de datos
    ResultSet rs = gr.getgraficarepuestomen();
    try {
        String nameAuto;
        int quantitySales;
        DefaultPieDataset data = new DefaultPieDataset();
        while (rs.next()) {
            nameAuto = rs.getString(3);
            quantitySales = rs.getInt(1);
            data.setValue(nameAuto, quantitySales);
        }
        JFreeChart chart = ChartFactory.createPieChart("GRAFICAS REPUESTO MENOS VENDIDOS", data, true, true,
                false);
        ChartFrame frame = new ChartFrame("Repuestos menos vendidos", chart);
        frame.pack();
        frame.setVisible(true);
        rs.close();
        gr.close();
    } catch (SQLException ex) {
        Logger.getLogger(LessSellRepuesto.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:local.Statistics.MostSellCars.java

/**
 * @param args the command line arguments
 *//*from w w w.j a v a2 s.  c  o m*/
public static void carrosMasVendidos() {
    Graficas_DAO gr = new Graficas_DAO();
    //obtencion de datos
    ResultSet rs = gr.getgraficaautomas();

    try {
        String nameAuto;
        int quantitySales;
        Object[] fila = new Object[3];
        DefaultPieDataset data = new DefaultPieDataset();
        while (rs.next()) {

            nameAuto = rs.getString(3);
            quantitySales = rs.getInt(1);
            data.setValue(nameAuto, quantitySales);
        }
        JFreeChart chart = ChartFactory.createPieChart("GRAFICAS AUTOS MAS VENDIDOS", data, true, true, false);
        ChartFrame frame = new ChartFrame("Autos mas vendidos", chart);
        frame.pack();
        frame.setVisible(true);

        rs.close();
        gr.close();
    } catch (SQLException ex) {
        Logger.getLogger(MostSellCars.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:gentracklets.conversions.java

public static double[] geo2radec(PVCoordinates obj, TopocentricFrame staF, Frame inertialFrame,
        AbsoluteDate epoch) {//www . ja va  2s  .c  om

    Vector3D rho = new Vector3D(0, 0, 0);

    try {
        rho = obj.getPosition().subtract(staF.getPVCoordinates(epoch, inertialFrame).getPosition());
    } catch (OrekitException ex) {
        Logger.getLogger(conversions.class.getName()).log(Level.SEVERE, null, ex);
    }

    double rho_mag = rho.getNorm();
    double DEC = FastMath.asin(rho.getZ() / rho_mag);
    double cosRA = 0.0;
    double sinRA = 0.0;
    double RA = 0.0;

    Vector3D v_site = new Vector3D(0, 0, 0);
    try {
        v_site = staF.getPVCoordinates(epoch, inertialFrame).getVelocity();
    } catch (OrekitException ex) {
        Logger.getLogger(conversions.class.getName()).log(Level.SEVERE, null, ex);
    }

    Vector3D rhoDot = obj.getVelocity().subtract(v_site);

    if (FastMath.sqrt(FastMath.pow(rho.getX(), 2) + FastMath.pow(rho.getY(), 2)) != 0) {
        cosRA = rho.getX() / FastMath.sqrt(FastMath.pow(rho.getX(), 2) + FastMath.pow(rho.getY(), 2));
        sinRA = rho.getY() / FastMath.sqrt(FastMath.pow(rho.getX(), 2) + FastMath.pow(rho.getY(), 2));
        RA = FastMath.atan2(sinRA, cosRA);
        if (RA <= 0) {
            RA = RA + 2 * FastMath.PI;
        }
    } else {
        sinRA = rhoDot.getY() / FastMath.sqrt(FastMath.pow(rhoDot.getX(), 2) + FastMath.pow(rhoDot.getY(), 2));
        cosRA = rhoDot.getX() / FastMath.sqrt(FastMath.pow(rhoDot.getX(), 2) + FastMath.pow(rhoDot.getY(), 2));
        RA = FastMath.atan2(sinRA, cosRA);
        if (RA <= 0) {
            RA = RA + 2 * FastMath.PI;
        }
    }

    double rhoDot_mag = rho.dotProduct(rhoDot) / rho_mag;
    double RAdot = (rhoDot.getX() * rho.getY() - rhoDot.getY() * rho.getX())
            / (-1 * FastMath.pow(rho.getY(), 2) - FastMath.pow(rho.getX(), 2));
    double DECdot = (rhoDot.getZ() - rhoDot_mag * FastMath.sin(DEC))
            / FastMath.sqrt(FastMath.pow(rho.getX(), 2) + FastMath.pow(rho.getY(), 2));

    double[] out = { RA, RAdot, DEC, DECdot, rho_mag, rhoDot_mag };

    return out;
}

From source file:com.a544jh.kanamemory.io.JsonFileWriter.java

/**
 * Saves the PlayerProfile to a JSON-formatted file. If the file exists, the
 * profile is added to the existing JSON-mapping, if a profile with the same
 * name already exists in th file, it will be overwritten. If the files does
 * not exist, a new JSON-formatted file will be created.
 *
 * @param profile The PlayerProfile to be saved.
 * @param filename The file to save the data to. Can be a JSON-formatted
 * file created by this method, or an nonexistent file.
 *///from   w  w w  .j  a  va2  s . co m
public static void saveProfile(PlayerProfile profile, String filename) {
    File file = new File(filename);
    JSONObject jo = null;

    //Create a new file if it doesn't exist
    if (!file.exists()) {
        try {
            file.createNewFile();
        } catch (IOException ex) {
            Logger.getLogger(JsonFileWriter.class.getName()).log(Level.SEVERE, null, ex);
        }
        //Create new empty JSONObject
        jo = new JSONObject();
    } else {
        //If the file exists
        try {
            //Read the JSONObject from the file
            jo = JsonFileReader.readFileToJsonObject(file);
        } catch (FileNotFoundException | JSONException ex) {
            Logger.getLogger(JsonFileWriter.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    try {
        //Put the profile's scores to be saved in the JSONOBject with the name as key
        jo.put(profile.getName(), profile.getScoresMap());
        //Write the actual file
        try (FileWriter writer = new FileWriter(file)) {
            writer.write(jo.toString(4));
        }
    } catch (JSONException | IOException ex) {
        Logger.getLogger(JsonFileWriter.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:com.mmone.gpdati.allotment.reader.AvailCrud.java

public static void saveAllotment(XmlRpcClient client, Integer hotelCode, java.util.Date startDt,
        java.util.Date endDt, Integer roomId, int bookingLimit) throws Exception {

    int iBookingLimit = new Integer(bookingLimit);

    int xrpcresult = modifyAllotment(client, startDt, endDt, AVAIL_ACTION_SET, iBookingLimit, 0, roomId,
            hotelCode);// w  w  w .j  av  a  2  s.c  o m
    Logger.getLogger("AvailCrud").log(Level.INFO, "xrpcresult=" + xrpcresult);

}

From source file:de.bluepair.sci.client.SHAUtils.java

public static MessageDigest getDigest() {
    try {/* w  w  w  . j  a v a 2s .c  o  m*/
        return MessageDigest.getInstance("SHA-512");

    } catch (NoSuchAlgorithmException ex) {
        Logger.getLogger(FileAnalysis.class.getName()).log(Level.SEVERE, null, ex);
        // try rescue with sha
        try {
            return MessageDigest.getInstance("SHA");
        } catch (NoSuchAlgorithmException ex1) {
            Logger.getLogger(FileAnalysis.class.getName()).log(Level.SEVERE, null, ex1);
            return null;
        }
    }
}