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:BLL.statsService.java

public ArrayList<top> getTop5User() {
    try {// www.j a va 2s .  c  om

        return sDAO.getTop5User();

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

From source file:mb.MbKorisnik.java

public Korisnik nadjiPoMailu(String email) {
    try {//from   w  w w. ja  va 2 s  .  co m
        return korisnikServiceBean.findUserByLoginName(email);
    } catch (Exception ex) {
        Logger.getLogger(MbKorisnik.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
}

From source file:org.shareok.data.documentProcessor.FileHandlerFactory.java

/**
 *
 * @param fileExtension//from   w ww.j  a v a 2s.c  om
 * @return
 */
public static FileHandler getFileHandlerByFileExtension(String fileExtension) {

    FileHandler fh = null;
    String beanName = "";

    try {
        String fileTypePath = DocumentProcessorUtil.getFilePathFromResources("filetypes.xml");
        Document fileTypeDoc = loadXMLFromString(fileTypePath);
        fileTypeDoc.getDocumentElement().normalize();
        Element docEle = fileTypeDoc.getDocumentElement();
        NodeList nl = docEle.getChildNodes();

        if (nl != null && nl.getLength() > 0) {
            for (int i = 0; i < nl.getLength(); i++) {
                if (nl.item(i).getNodeType() == Node.ELEMENT_NODE) {
                    Element el = (Element) nl.item(i);
                    String nodeVal = el.getTextContent();
                    if (nodeVal.equals(fileExtension)) {
                        beanName = el.getAttribute("bean");
                        break;
                    }
                }
            }
        }

        ApplicationContext context = new ClassPathXmlApplicationContext("documentProcessorContext.xml");
        fh = (FileHandler) context.getBean(beanName);

    } catch (Exception ex) {
        Logger.getLogger(DocumentProcessorUtil.class.getName()).log(Level.SEVERE, null, ex);
    }

    return fh;
}

From source file:com.neu.edu.DAO.DAO.java

public Connection getConnection() {
    Connection conn = null;/*from  w ww.  j av  a2  s.c  o m*/
    try {
        conn = DriverManager.getConnection(dburl, dbuser, dbpassword);

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

From source file:de.hsbremen.websocketChat.WebSocketSession.java

@Override
public void onMessage(String data) {
    JSONObject recv = new JSONObject(data);

    if (recv.has("disconnect")) {
        connection.close();//from w w  w  . ja  v a  2s  .co  m
    } else {
        if (recv.has("status")) {
            try {
                connection.sendMessage((new JSONObject()).put("login", (user != null) ? "1" : "0").toString());
            } catch (IOException ex) {
                Logger.getLogger(WebSocketSession.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else if (user != null) {
            if (recv.has("changeUser")) {
                ServletWebSocket.msgs.add(
                        new Message(user.getName(), "change name to \"" + recv.getString("changeUser") + "\""));
                user.setName(recv.getString("changeUser"));
            } else if (recv.has("msg")) {
                ServletWebSocket.msgs.add(new Message(user.getName(), recv.getString("msg")));
                ServletWebSocket.onNotifyAll();
            }
        } else {
            if (recv.has("setUser")) {
                try {
                    user = new User(recv.getString("setUser"));
                    ServletWebSocket.msgs.add(new Message(user.getName(), "auto hallo"));
                    connection.sendMessage(sendCurrentMessages().put("login", "1").toString());
                } catch (IOException ex) {
                    Logger.getLogger(WebSocketSession.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
    }
}

From source file:br.com.great.gerenciamento.GerenciadorJogos.java

@Override
public void run() {
    while (!isInterrupted()) {

        try {/* w w w.j av a2  s. c  o m*/
            //             enviarLocalizacao();
            Thread.sleep(5000);
        } catch (InterruptedException ex) {
            Logger.getLogger(GerenciadorJogos.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

From source file:oobbit.database.ConnectionManager.java

/**
 * Connects to the Database described in the database properties file.
 *///from  w w w . j a va 2s .c om
@PostConstruct
public void connect() {
    try {
        connection = DriverManager.getConnection(settings.getConnectorString());
    } catch (SQLException ex) {
        connection = null;
        Logger.getLogger(ConnectionManager.class.getName()).log(Level.SEVERE,
                "Unexpected SQLException occured.", ex);
        System.exit(1); // Force quit (TODO?)
    }
}

From source file:loc.zenoss.util.DeviceFactory.java

private DeviceFactory() {
    try {// ww  w  .ja  v a  2 s.c o  m
        config = new PropertiesConfiguration("devices.properties");
    } catch (ConfigurationException ex) {
        Logger.getLogger(DeviceFactory.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:br.eb.ime.labprog3.tam.DefaultController.java

@RequestMapping(value = "index")
public String index(ModelMap map) {

    String fileName = "../../resources/xml/aeroportos.xml";
    Resource resource = null;/*w w  w .j  a  v a 2 s. com*/

    resource = new ClassPathResource(fileName);

    AeroportoDAO dao = null;
    try {
        dao = new AeroportoDAO(resource.getFile());
    } catch (IOException ex) {
        Logger.getLogger(DefaultController.class.getName()).log(Level.SEVERE, null, ex);
    }

    List<Aeroporto> listaDeAeroportos = null;

    if (dao != null) {
        listaDeAeroportos = dao.listarAeroportos();
        map.addAttribute("listaDeAeroportos", listaDeAeroportos);

    }

    return "index";
}

From source file:it.cnr.ilc.tokenizer.utils.InputToString.java

/**
 * Convert an inputstream into a string//from w  w  w  .  j  a v a  2 s.  c om
 * @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(Utilities.class.getName()).log(Level.SEVERE, message);
    }

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