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.netcracker.financeapp.controller.type.typeAddServlet.java

@Override
public void init(ServletConfig config) {
    try {//from   w w w . j a v  a2s  .  com
        super.init(config);
        SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, config.getServletContext());
    } catch (ServletException ex) {
        Logger.getLogger(typeAddServlet.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.liscs.server.utils.JacksonUtils.java

public String objectToString(T t) {
    try {/*from   ww  w.  java2 s  .c  om*/
        ObjectMapper objectMapper = new ObjectMapper();
        return objectMapper.writeValueAsString(t);
    } catch (JsonProcessingException ex) {
        Logger.getLogger(JacksonUtils.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
}

From source file:Logi.GSeries.Libraries.Encryption.java

public static String encrypt(String decryptedString, String password) {
    try {/*  ww w  .  jav a2s. co  m*/
        // build the initialization vector (randomly).
        SecureRandom random = new SecureRandom();
        byte initialVector[] = new byte[16];
        //generate random 16 byte IV AES is always 16bytes
        random.nextBytes(initialVector);
        IvParameterSpec ivspec = new IvParameterSpec(initialVector);
        SecretKeySpec skeySpec = new SecretKeySpec(password.getBytes("UTF-8"), "AES");
        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
        cipher.init(Cipher.ENCRYPT_MODE, skeySpec, ivspec);
        byte[] encrypted = cipher.doFinal(decryptedString.getBytes());
        byte[] encryptedWithIV = new byte[encrypted.length + initialVector.length];
        System.arraycopy(encrypted, 0, encryptedWithIV, 0, encrypted.length);
        System.arraycopy(initialVector, 0, encryptedWithIV, encrypted.length, initialVector.length);
        return Base64.encodeBase64String(encryptedWithIV);
    } catch (Exception ex) {
        Logger.getLogger(Encryption.class.getName()).log(Level.SEVERE, null, ex);
        return "Error";
    }
}

From source file:dumbara.view.Chart1.java

public static void byIncome() {
    DefaultCategoryDataset objDataset = new DefaultCategoryDataset();
    try {/*from   w  w w . j av a 2  s .com*/
        Sale[] sale = SalesController.viewAllSales();
        for (Sale sale1 : sale) {
            objDataset.setValue(sale1.getIncome(), "Sales Progress", sale1.getSalesID());
        }
    } catch (ClassNotFoundException | SQLException ex) {
        Logger.getLogger(Chart1.class.getName()).log(Level.SEVERE, null, ex);
    }
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.MONTH, -1);
    Date result = cal.getTime();
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("E yyyy.MM.dd");
    String format = simpleDateFormat.format(result);
    Date date = new Date();
    String format1 = simpleDateFormat.format(date);

    JFreeChart objChart = ChartFactory.createBarChart(
            "Sales Comparisson by Sales ID from " + format + " to " + format1, "Sales ID", "Sales Income",
            objDataset, PlotOrientation.VERTICAL, true, true, false

    );
    ChartFrame frame = new ChartFrame("Data Analysis Wizard - v2.1.4", objChart);
    frame.pack();
    frame.setSize(1300, 600);
    frame.setVisible(true);
    frame.setLocationRelativeTo(null);
}

From source file:bd.ac.seu.springdemo.SpringDemo.java

public SpringDemo() {
    ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
    BankAccount a = (SavingsAccount) context.getBean("rakib_savings");
    BankAccount b = (CurrentAccount) context.getBean("ashiq_current");
    BankAccount c = (SavingsAccount) context.getBean("monirul_savings");

    try {//ww  w  .j av a 2  s  .co m
        a.deposit(100);
        b.deposit(100);
        c.deposit(100);
    } catch (NegativeNumberException ex) {
        Logger.getLogger(SpringDemo.class.getName()).log(Level.SEVERE, null, ex);
    }
    System.out.println(a);
    System.out.println(b);
    System.out.println(c);
}

From source file:com.monpie.histogram.RandomizeArray.java

@Override
public void run() {

    try {/*from   w w  w . ja v a 2  s  .co  m*/
        //losowanie liczb
        for (int i = 0; i < ROWS; i++) {
            for (int j = 0; j < COLUMNS; j++) {
                array[i][j] = RandomStringUtils.randomAscii(1);
                System.out.println(array[i][j]);
                fileWriter.write(array[i][j]);
            }
            fileWriter.write("\n");
        }
        fileWriter.close();
    } catch (IOException ex) {
        Logger.getLogger(RandomizeArray.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:ca.weblite.jdeploy.impl.MavenDeploy.java

public Element getPomRoot() {
    if (pomRoot == null) {
        try {//  w  w w .java  2 s  . c  o  m
            String pomStr = FileUtils.readFileToString(pom, "UTF-8");
            XMLParser p = new XMLParser();
            pomRoot = p.parse(new StringReader(pomStr));
        } catch (IOException ex) {
            Logger.getLogger(MavenDeploy.class.getName()).log(Level.SEVERE, null, ex);
            throw new RuntimeException(ex);
        }
    }
    return pomRoot;
}

From source file:ffnn.FFNNTubesAI.java

public static Instances filterNominalNumeric(Instances i) {
    NominalToBinary filter = new NominalToBinary();
    Instances temp_instances = new Instances(i);
    if (temp_instances.classIndex() > -1) { //Jika ada classs index
        temp_instances.setClassIndex(-1); //Unset
    }//from  www  .jav  a2 s.com
    try {
        filter.setInputFormat(temp_instances);
        temp_instances = Filter.useFilter(temp_instances, filter);
    } catch (Exception ex) {
        Logger.getLogger(FFNN.class.getName()).log(Level.SEVERE, null, ex);
    }
    return temp_instances;
}

From source file:it.cnr.ilc.ilcioutils.IlcInputToString.java

/**
 * Convert an inputstream into a string/*from w  ww . j  av a 2 s . c  o m*/
 *
 * @param theUrl the url to get the context from
 * @return the string from the input
 */
public static String convertInputStreamFromUrlToString(String theUrl) {
    StringWriter writer = new StringWriter();
    InputStream is = null;
    String encoding = "UTF-8";
    String message = "";
    String theString = "";
    try {
        is = new URL(theUrl).openStream();
        IOUtils.copy(is, writer, encoding);
        theString = writer.toString();
    } catch (Exception e) {
        message = "IOException in coverting the stream into a string " + e.getMessage();
        Logger.getLogger(CLASS_NAME).log(Level.SEVERE, message);
    }

    //System.err.println("DDDD " + theString);
    IOUtils.closeQuietly(is);
    IOUtils.closeQuietly(writer);
    return theString;
}

From source file:com.github.wnameless.factorextractor.FactorExtractor.java

/**
 * Returns a Map{@literal <String, Object>} which is extracted from annotated
 * methods of input objects./*from www . j  av a 2 s.c  o  m*/
 * 
 * @param objects
 *          an array of objects
 * @return a Map{@literal <String, Object>}
 */
public static Map<String, Object> extract(Object... objects) {
    for (Object o : objects) {
        if (o == null)
            throw new NullPointerException("Null object is not allowed");
    }

    Map<String, Object> factors = new HashMap<String, Object>();
    for (Object o : objects) {
        Class<?> testClass = o.getClass();
        for (Method m : testClass.getMethods()) {
            Factor factor = AnnotationUtils.findAnnotation(m, Factor.class);
            if (factor != null) {
                try {
                    factors.put(factor.value(), m.invoke(o));
                } catch (InvocationTargetException wrappedExc) {
                    Throwable exc = wrappedExc.getCause();
                    Logger.getLogger(FactorExtractor.class.getName()).log(Level.SEVERE, m + " failed: " + exc,
                            wrappedExc);
                } catch (Exception exc) {
                    Logger.getLogger(FactorExtractor.class.getName()).log(Level.SEVERE,
                            "INVALID @Factor: " + m + exc, exc);
                }
            }
        }
    }

    return factors;
}