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.MainServlet.java

@Override
public void init(ServletConfig config) {
    try {/*from   w ww  . java2 s .com*/
        super.init(config);
        SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, config.getServletContext());
    } catch (ServletException ex) {
        Logger.getLogger(MainServlet.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.eddy.malupdater.MalUpdater.java

public static void initMainLogger() throws IOException {
    Handler handler = new FileHandler("error.log", 8096, 1);
    Logger.getLogger("com.eddy.malupdater").addHandler(handler);
}

From source file:com.mp3bot.JsonSink.java

public boolean handle(List<MediaInfo> medias) {
    ObjectMapper om = new ObjectMapper();
    try {/*  w  ww.  j  a  v a2  s.c  o  m*/
        om.writeValue(new File("result.json"), medias);
    } catch (IOException ex) {
        Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
        return false;
    }
    om = null;
    return true;
}

From source file:it.av.wikipedia.client.WikipediaClient.java

public static String Query(QueryParameters params) {
    try (CloseableHttpClient httpclient = HttpClients.custom()
            .setDefaultRequestConfig(RequestConfig.custom().setCookieSpec(CookieSpecs.STANDARD).build())
            .build()) {/*from www.j a v a2s. c om*/
        StringBuilder url = new StringBuilder(ENDPOINT);
        url.append(params.toURLQueryString());

        //System.out.println("GET: " + url);
        HttpGet request = new HttpGet(url.toString());
        request.setHeader("User-Agent", "FACWikiTool");

        // Create a custom response handler
        ResponseHandler<String> responseHandler = (final HttpResponse response) -> {
            int status = response.getStatusLine().getStatusCode();
            if (status >= 200 && status < 300) {
                HttpEntity entity = response.getEntity();
                return entity != null ? EntityUtils.toString(entity) : null;
            } else {
                throw new ClientProtocolException("Unexpected response status: " + status);
            }
        };

        return httpclient.execute(request, responseHandler);
    } catch (IOException ex) {
        Logger.getLogger(WikipediaClient.class.getName()).log(Level.SEVERE, null, ex);
        return null;
    }
}

From source file:com.app.inventario.logica.seguridad.IntentosLoginLogicaImpl.java

public void resetearIntentosFallidos(String usuario) throws HibernateException {
    try {// w w w. j av  a2 s .  co  m
        intentosLoginDAO.resetearIntentosFallidos(usuario);
    } catch (HibernateException he) {
        Logger.getLogger(IntentosLoginLogicaImpl.class.getName()).log(Level.SEVERE, null, he);
        throw he;
    }
}

From source file:com.netcracker.financeapp.controller.bank_card.BankCardAddServlet.java

@Override
public void init(ServletConfig config) {
    try {/* www . j  a  va2s  .c  om*/
        super.init(config);
        SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, config.getServletContext());
    } catch (ServletException ex) {
        Logger.getLogger(BankCardAddServlet.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:uta.ak.usttmp.common.dao.mapper.TextRowMapper.java

@Override
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {

    try {//  w  w  w. j a v a 2  s.  c  om
        Text rt = new Text();
        rt.setId(rs.getLong("mme_eid"));

        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        rt.setCreateTime(formatter.parse(rs.getString("text_createdate")));

        rt.setText(rs.getString("text"));
        rt.setTitle(rs.getString("title"));
        rt.setRawTextId(rs.getLong("rawtext_id"));
        rt.setTag(rs.getString("tag"));

        return rt;
    } catch (ParseException ex) {
        Logger.getLogger(RawTextRowMapper.class.getName()).log(Level.SEVERE, null, ex);
    }

    return null;
}

From source file:com.crocodoc.ws.implementacao.WebServicesCrocoDoc.java

@Override
public Map<String, Object> status(String uuid) {
    try {/*from   w w  w.j av  a 2  s  . co m*/
        return CrocodocDocument.status(uuid);
    } catch (CrocodocException ex) {
        Logger.getLogger(WebServicesCrocoDoc.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
}

From source file:extractcode.TraversalFiles.java

public static void fileList(File inputFile, int node, ArrayList<String> path, String folderPath) {
    node++;//from www .  j  a  v  a  2  s  .  c o m
    File[] files = inputFile.listFiles();
    if (!inputFile.exists()) {
        System.out.println("File doesn't exist!");
    } else if (inputFile.isDirectory()) {
        path.add(inputFile.getName());

        for (File f : files) {
            for (int i = 0; i < node - 1; i++) {
                System.out.print(" ");
            }
            System.out.print("|-" + f.getPath());

            String ext = FilenameUtils.getExtension(f.getName());
            if (ext.equals("java")) {
                try {
                    System.out.println(" => extracted");

                    //Get extracted file location and add it to output file name,
                    //in order to avoid files in different folder 
                    //have the same name.
                    String fileLocation = "";
                    for (String tmpPath : path) {
                        fileLocation += "-" + tmpPath;
                    }

                    String outFilePath = folderPath + "/" + f.getName() + fileLocation + "-allcode.txt";

                    //create output file
                    File outputFile = new File(outFilePath);
                    if (outputFile.createNewFile()) {
                        System.out.println("Create successful: " + outputFile.getName());
                    }

                    //extract comments
                    ExtractCode.extractCode(f, outputFile);
                } catch (IOException ex) {
                    Logger.getLogger(TraversalFiles.class.getName()).log(Level.SEVERE, null, ex);
                }
            } else {
                System.out.println();
            }
            fileList(f, node, path, folderPath);
        }
        path.remove(node - 1);
    }
}