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.mmone.gpdati.allotment.reader.AllotmentFileReader.java

private void loadData() throws IOException {
    try {//from  ww w .jav a 2 s.com
        Logger.getLogger(AllotmentFileReader.class.getName()).log(Level.INFO,
                "**** target filename " + fileName);
        File file = new File(fileName);
        if (file.exists()) {
            Logger.getLogger(AllotmentFileReader.class.getName()).log(Level.INFO,
                    "**** file exist " + fileName);
            lines = FileUtils.readLines(file, "UTF-8");
        } else {
            Logger.getLogger(AllotmentFileReader.class.getName()).log(Level.INFO,
                    "**** file not found " + fileName);
            throw new IOException("File not found " + fileName);
        }
    } catch (Exception e) {
        throw new IOException(e.getMessage());
    }

}

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

/**
 * Creates a new PlayerProfile object from a JSON file
 *
 * @param profileName The name field of the profile to be loaded, used as
 * the key in the JSON mapping.// w w  w.j  a v  a2s.  co  m
 * @param filename Name of the JSON-formatted file to read the data from.
 * @return A new PlayerProfile with the character scores loaded from the
 * file.
 */
public static PlayerProfile loadProfile(String profileName, String filename) {
    PlayerProfile profile = new PlayerProfile(profileName);
    File file = new File(filename);
    try {
        //Get the profile's kanaScores from the file by using the name as key
        JSONObject kanaScores = readFileToJsonObject(file).getJSONObject(profileName);
        //Fill the profile's EnumMap with values
        populateKanaScores(profile, kanaScores);

    } catch (FileNotFoundException | JSONException ex) {
        Logger.getLogger(JsonFileReader.class.getName()).log(Level.SEVERE, null, ex);
    }
    return profile;
}

From source file:fr.francetelecom.callback.ItemReaderHeader.java

@Override
public void handleLine(String string) {
    try {/*from  www  . j a  va 2  s . c o m*/
        Object mapLine = lineMapper.mapLine(string, 1);
        System.out.println("header : " + mapLine);
    } catch (Exception ex) {
        Logger.getLogger(ItemReaderHeader.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:io.bluecell.service.GateDocumentServiceTest.java

@BeforeClass
public static void setUpClass() {
    if (!Gate.isInitialised()) {
        Gate.setGateHome(new File("/home/rich/GATE_Developer_8.1"));
        try {//from  w ww . j a  va  2 s .c o m
            Gate.init();
        } catch (GateException ex) {
            Logger.getLogger(GateDocumentServiceTest.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

From source file:br.edimarmanica.weir2.rule.Loader.java

/**
 *
 * @param rule//from ww  w.j av  a2 s .  c  o  m
 * @param formatted valores formatados como na avaliao?
 * @return Map<PageId, Value>
 *
 */
public static Map<String, String> loadPageValues(File rule, boolean formatted) {
    Map<String, String> pageValues = new HashMap<>();

    try (Reader in = new FileReader(rule.getAbsolutePath())) {
        try (CSVParser parser = new CSVParser(in, CSVFormat.EXCEL.withHeader())) {
            for (CSVRecord record : parser) { //para cada value
                String url = formatURL(record.get("URL"));
                String value = record.get("EXTRACTED VALUE");

                if (formatted) {
                    value = Formatter.formatValue(value);
                }

                if (!value.trim().isEmpty()) {
                    pageValues.put(url, value);
                }
            }
        }
    } catch (FileNotFoundException ex) {
        Logger.getLogger(Loader.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(Loader.class.getName()).log(Level.SEVERE, null, ex);
    }
    return pageValues;
}

From source file:com.fullhousedev.globalchat.bukkit.PluginMessageManager.java

public static void sendRawMessage(String subChannel, String serverName, byte[] message, Plugin pl) {
    ByteArrayOutputStream b = new ByteArrayOutputStream();
    DataOutputStream out = new DataOutputStream(b);

    try {/*from w w w  . java  2  s .c o m*/
        out.writeUTF("Forward");
        out.writeUTF(serverName);
        out.writeUTF(subChannel);

        out.writeShort(message.length);
        out.write(message);
    } catch (IOException ex) {
        Logger.getLogger(GlobalChat.class.getName()).log(Level.SEVERE, null, ex);
    }

    Player p = Bukkit.getOnlinePlayers()[0];

    p.sendPluginMessage(pl, "BungeeCord", b.toByteArray());
}

From source file:ch.newscron.referral.ReferralManager.java

/**
 * Provides a connection to the database specified (see fields)
 * @return a Connection for the database
 *///from  w  w w.j av a 2 s. c om
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(ReferralManager.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
}

From source file:BLL.statsService.java

public ArrayList<top> getTop5Gouvernorat() {
    try {// w  ww . j a  v a2  s.  c o m

        return sDAO.getTop5Gouvernorat();

    } catch (SQLException ex) {
        Logger.getLogger(statsService.class.getName()).log(Level.SEVERE, null, ex);
        return null;
    }
}

From source file:com.aalto.config.WebInitializer.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    Logger.getLogger("config").log(Level.INFO, "log: Webinitializer onStartup method!!");
    AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
    ctx.register(Config.class);
    ctx.setServletContext(servletContext);
    Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx));
    servlet.addMapping("/");
    servlet.setLoadOnStartup(1);/*from   w  ww .  j  av a 2  s  . co  m*/
}

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

@Override
public void commence(HttpServletRequest request, HttpServletResponse response,
        AuthenticationException authException) throws IOException {
    Logger.getLogger("org.example.security.RestAuthenticationEntryPoint")
            .info("Inside RestAuthenticationEntryPoint...");
    response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized");
}