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.ness.academy.connection.QueryInstance.java

public String getQuery(String query) {
    try {//from w w  w .j ava2 s . c  om
        Map<String, String> queries = queryLoader.load(SQL_FILE);
        return queries.get(query);
    } catch (IOException ex) {
        Logger.getLogger(QueryInstance.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
}

From source file:FTP.FTPUploadFileDemo.java

public static void UploadFile(String arquivo, String nomeArquivo) {
    InputStream inputStream = null;
    try {//from  w  w w  .j a v  a2 s  .c  o m
        // APPROACH #1: uploads first file using an InputStream
        File firstLocalFile = new File(arquivo);
        String firstRemoteFile = nomeArquivo;
        inputStream = new FileInputStream(firstLocalFile);
        System.out.println("Start uploading first file");
        boolean done = ftpClient.storeFile(firstRemoteFile, inputStream);
        inputStream.close();
        if (done) {
            System.out.println("The first file is uploaded successfully.");
        }
    } catch (FileNotFoundException ex) {
        Logger.getLogger(FTPUploadFileDemo.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(FTPUploadFileDemo.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
        try {
            inputStream.close();
        } catch (IOException ex) {
            Logger.getLogger(FTPUploadFileDemo.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

From source file:com.app.inventario.servicio.seguridad.IntentosLoginServicioImpl.java

public void actualizarIntentosFallidos(String usuario) throws HibernateException {
    try {/*from  w  ww .  j a v  a 2s. c o m*/
        intentosLoginLogica.actualizarIntentosFallidos(usuario);
    } catch (HibernateException he) {
        Logger.getLogger(IntentosLoginServicioImpl.class.getName()).log(Level.SEVERE, null, he);
        throw he;
    }
}

From source file:org.example.security.RestAuthenticationSuccessHandler.java

@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,

        Authentication authentication) throws IOException, ServletException {
    Logger.getLogger("org.example.server.security.RestAuthenticationSuccessHandler")
            .info("Autherization is successful...");
}

From source file:com.controller.CTraderGetAllBrokers.java

public static List<Broker> getBrokerList() {
    String brokersString = "";
    try {//  ww w .  j a  va  2s  .  c om
        HttpResponse<JsonNode> resp = Unirest.get("http://139.59.17.119:8080/api/admin/brokers")
                .header("content-type", "application/json").asJson();
        //THIS IS THE JSONRESPONSE TURNED INTO JSONOBJECT  
        JSONObject myRespO = new JSONObject(resp.getBody());
        JSONArray arrJson = myRespO.getJSONArray("array");
        //GET ORDERS FROM ARRAY
        List<Broker> brokerList = new ArrayList<>();

        for (int i = 0; i < arrJson.length(); i++) {
            JSONObject currentBr = arrJson.getJSONObject(i);
            Broker currentBroker = JsonParsing.parseJsonToBrokerObject(currentBr.toString());
            String currName = currentBroker.getName();
            brokerList.add(currentBroker);
            brokersString += currName + ", ";
        }
        System.out.println("Added Brokers to dropdown-list: " + brokersString);
        return brokerList;
    } catch (UnirestException | JSONException ex) {
        Logger.getLogger(ControllerPMCreatedOrders.class.getName()).log(Level.SEVERE, null, ex);
        return null;
    }
}

From source file:com.blogspot.ryanfx.auth.GoogleUtil.java

/**
 * Returns an email address associated with an auth token, if it exists.
 * @param token auth token/*from  ww  w . j a  va2 s . co  m*/
 * @return
 * @throws LoginException
 * @throws IOException
 * @throws ParseException
 */
public static String submitUserToken(String token) throws LoginException, IOException, ParseException {
    JSONObject jsonObject = null;
    String email = null;
    JSONParser parser = new JSONParser();
    String jsonResult = null;
    jsonResult = issueTokenGetRequest(token);
    if (jsonResult != null) {
        jsonObject = (JSONObject) parser.parse(jsonResult);
        //Gets the email value from the json result
        email = (String) jsonObject.get("email");
        //Logs the request for our knowledge
        Logger.getLogger(GoogleUtil.class.getName()).severe("Garage request from user: " + email);
    }
    return email;
}

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

public AMIDevice(String name, double cpuSpeed, int totalMemory) {
    super(name, cpuSpeed, totalMemory, DeviceType.AMI);
    try {/* ww w .  j a  v a  2  s. c  om*/
        byte[] imageInByte;
        imageInByte = IOUtils.toByteArray(getClass().getClassLoader().getResourceAsStream("image/meter.jpeg"));
        icon = new MyLayeredIcon(new ImageIcon(imageInByte).getImage());
    } catch (IOException ex) {
        Logger.getLogger(AMIDevice.class.getName()).log(Level.SEVERE, null, ex);
    }
}

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

public static byte[] scrypt_1024_4_2(byte[] p, byte[] s) {
    try {/*w w w . ja va 2  s  .  c om*/
        return SCrypt.scrypt(p, s, 1024, 4, 2, HASH_LEN);
    } catch (GeneralSecurityException ex) {
        Logger.getLogger(Utils.class.getName()).log(Level.SEVERE, null, ex);
        return null;
    }
}

From source file:org.example.security.RestUsernamePasswordAuthenticationFilter.java

@Override
protected boolean requiresAuthentication(HttpServletRequest request, HttpServletResponse response) {
    Logger.getLogger("org.example.server.security.RestUsernamePasswordAuthenticationFilter")
            .info("Entering RestUsernamePasswordAuthenticationFilter ...");
    boolean retVal = false;
    String username = request.getParameter("j_username");
    String password = request.getParameter("j_password");
    if (username != null && password != null) {
        Authentication authResult = null;
        try {/*from  w  ww. j  a  v a 2  s  .  co  m*/
            authResult = attemptAuthentication(request, response);
            if (authResult == null) {
                retVal = false;
            }
        } catch (AuthenticationException failed) {
            try {
                unsuccessfulAuthentication(request, response, failed);
            } catch (IOException e) {
                retVal = false;
            } catch (ServletException e) {
                retVal = false;
            }
            retVal = false;
        }
        try {
            successfulAuthentication(request, response, null, authResult);
        } catch (Exception e) {
            retVal = false;
        }
        return false;
    } else {
        retVal = true;
    }
    return retVal;
}

From source file:edu.pitt.sis.infsci2730.finalProject.web.LogoutController.java

@RequestMapping(value = "", method = RequestMethod.GET)
public void logout(HttpServletResponse res, HttpSession session) {
    session.invalidate();//from w  w w  .ja  va 2 s  .  c  o m
    try {
        res.sendRedirect("/eBusiness/user");
    } catch (IOException ex) {
        Logger.getLogger(LogoutController.class.getName()).log(Level.SEVERE, null, ex);
    }
}