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:controller.NewEntryImageControllerTest.java

@AfterClass
public static void tearDownClass() {
    File file = new File(System.getProperty("user.dir") + fSeparator + "MyDiaryBook");
    try {//  ww  w.  ja  va  2 s  .  c  o  m
        FileUtils.deleteDirectory(file);
    } catch (IOException ex) {
        Logger.getLogger(NewEntryImageControllerTest.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:atualizador.Atualizador.java

private static void VerificarAtualizacao(String MD5FileName, String SistemaFileName, String DiretorioFTP) {
    try {//w w w. ja  v a  2  s.com

        FTPDownload(MD5FileName, DiretorioFTP); //Arquivo TXT com o MD5

        //Le o valor do arquivo
        FileReader arq = new FileReader(MD5FileName);

        BufferedReader lerArq = new BufferedReader(arq);
        String linha = lerArq.readLine();

        String Md5FPT = linha;
        String Md5Local = geraHash(new File(SistemaFileName)); //Mudar o file name 
        if (!ValidaVersao(Md5FPT, Md5Local)) {
            System.out.println("Atualizando");
            FTPDownload(SistemaFileName, DiretorioFTP);
        }

    } catch (NoSuchAlgorithmException | FileNotFoundException ex) {
        Logger.getLogger(Atualizador.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(Atualizador.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.punyal.medusaserver.californiumServer.core.MedusaValidation.java

public static Client check(String medusaServerAddress, String myTicket, String ticket) {
    CoapClient coapClient = new CoapClient();
    Logger.getLogger("org.eclipse.californium.core.network.CoAPEndpoint").setLevel(Level.OFF);
    Logger.getLogger("org.eclipse.californium.core.network.EndpointManager").setLevel(Level.OFF);
    Logger.getLogger("org.eclipse.californium.core.network.stack.ReliabilityLayer").setLevel(Level.OFF);

    CoapResponse response;//from  w  w w  .  j ava2 s . co m

    coapClient.setURI(medusaServerAddress + "/" + MEDUSA_SERVER_VALIDATION_SERVICE_NAME);
    JSONObject json = new JSONObject();
    json.put(JSON_MY_TICKET, myTicket);
    json.put(JSON_TICKET, ticket);
    response = coapClient.put(json.toString(), 0);

    if (response != null) {
        //System.out.println(response.getResponseText());

        try {
            json.clear();
            json = (JSONObject) JSONValue.parse(response.getResponseText());
            long expireTime = (Long) json.get(JSON_TIME_TO_EXPIRE) + (new Date()).getTime();
            String userName = json.get(JSON_USER_NAME).toString();
            String[] temp = json.get(JSON_ADDRESS).toString().split("/");
            String address;
            if (temp[1] != null)
                address = temp[1];
            else
                address = "0.0.0.0";
            Client client = new Client(InetAddress.getByName(address), userName, null,
                    UnitConversion.hexStringToByteArray(ticket), expireTime);
            return client;
        } catch (Exception e) {
        }

    } else {
        // TODO: take 
    }
    return null;
}

From source file:ch.newscron.registration.UserRegistration.java

/**
 * Provides a connection to the database specified (see fields)
 * @return a Connection for the database
 *//*w  w  w. j  a  va 2  s  . co m*/
public static Connection connect() {
    try {
        Class.forName("com.mysql.jdbc.Driver").newInstance();
        Connection connection = DriverManager.getConnection(DBurl, username, password);
        return connection;
    } catch (SQLException e) {
        throw new IllegalStateException("Cannot connect the database! ", e);
    } catch (Exception ex) {
        Logger.getLogger(UserRegistration.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
}

From source file:fr.cntcnc.migration.html4joomla1to3.CNTparser.java

public static void imprimeurArticles(String listeArticles, String nomFichier) {
    try {// www.  j  a  v a2s . c o m
        //        entre : String[] listeArticles ...   String articleComplet = "";
        //        concatnation des sous article
        //        for (String listeArticle : listeArticles) {
        //            articleComplet+=listeArticle;
        //        }
        FileUtils.writeStringToFile(new File(nomFichier + ".txt"), listeArticles);
        System.out.println("---- Impression de l'article ---" + nomFichier + ".txt");
    } catch (IOException ex) {
        Logger.getLogger(CNTparser.class.getName()).log(Level.SEVERE, null, ex);
    }
}

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

/**
 * Read the content from file//from w  ww .  java 2s  .  c  om
 *
 * @param file the file to read from
 * @return a list of lines
 */
public static List<String> readFromFile(File file) {
    List<String> lines = new ArrayList<>();
    String message;
    String encoding = "UTF-8";
    try {
        lines = FileUtils.readLines(file, encoding);

    } catch (Exception e) {
        message = String.format("IOException in reading the file %s %s" + file.getName(), e.getMessage());
        Logger.getLogger(CLASS_NAME).log(Level.SEVERE, message);
    }

    return lines;
}

From source file:org.consultjr.mvc.core.components.formatters.DateFormatter.java

@Override
public String print(Date object, Locale locale) {
    DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    try {/* ww w  .ja v  a  2  s .  c  o  m*/
        return formatter.format(object).toString();
    } catch (Exception ex) {
        Logger.getLogger(DateFormatter.class.getName()).log(Level.SEVERE, null, ex);
        return null;
    }
}

From source file:de.kaojo.chat.TextMessageDecoder.java

@Override
public Message decode(String s) throws DecodeException {
    ObjectMapper mapper = new ObjectMapper();
    try {/*from www.  ja va  2  s  .  c  om*/
        return mapper.readValue(s, Message.class);
    } catch (IOException ex) {
        Logger.getLogger(TextMessageDecoder.class.getName()).log(Level.SEVERE, null, ex);
        throw new DecodeException(s, "Encoded message could not be parsed to Message.class");
    }
}

From source file:at.tugraz.kmi.medokyservice.ErrorLogNotifier.java

public static void errorLog(String msg) {
    Logger logger = Logger.getLogger(ErrorLogNotifier.class.getName());
    logger.warning(msg);
}

From source file:es.caib.sgtsic.util.DataHandlers.java

public static DataHandler byteArrayToDataHandler(byte[] arrayByte) {

    InputStream is = new BufferedInputStream(new ByteArrayInputStream(arrayByte));

    String mimetype = "";

    try {// w ww.  j  av a 2s . c o  m
        mimetype = URLConnection.guessContentTypeFromStream(is);
    } catch (IOException ex) {
        Logger.getLogger(DataHandlers.class.getName()).log(Level.SEVERE, null, ex);
    }

    DataSource dataSource = new ByteArrayDataSource(arrayByte, mimetype);

    return new DataHandler(dataSource);

}