Code example for Logger

Methods: info, warning

0
     * @throws NamingException 
     */ 
    private DataManagerLocal createDataRegistry() { 
        Context ctx;
        try { 
            log.info("Trying to get InitialContext for JNDI-Lookup...");
            ctx = new InitialContext();
            DataManagerLocal dataRegistry = null;
            try { 
                dataRegistry = (DataManagerLocal) ctx
                        .lookup("planets-project.eu/DataManager/local"); 
            } catch (NoInitialContextException x) {
                log.warning("No initial context, trying via service...");
                URL url = null;
                try { 
                    url = new URL(this.host
                            + "/storage-ifr-storage-ejb/DataManager?wsdl"); 
                } catch (MalformedURLException e) {
                    e.printStackTrace();
                } 
                Service service = Service.create(url, new QName(
                        "http://planets-project.eu/ifr/core/storage/data", 
                        "DataManager")); 
                dataRegistry = service.getPort(DataManagerLocal.class);
                // x.printStackTrace(); 
            } 
            log.info("Created dataRegistry-Object...");
 
            return dataRegistry;
        } catch (NamingException e1) {
            e1.printStackTrace();
        }