Code example for LogManager

Methods: readConfiguration

0
        Properties p = new Properties();
        p.put("java.util.logging.SocketHandler.level", "FINE");
        p.put("java.util.logging.SocketHandler.filter", className
                + "$MockFilter"); 
        p.put("java.util.logging.SocketHandler.formatter", className
                + "$MockFormatter"); 
        p.put("java.util.logging.SocketHandler.encoding", "iso-8859-1");
        p.put("java.util.logging.SocketHandler.host", "127.0.0.1");
        p.put("java.util.logging.SocketHandler.port", "6666");
        LOG_MANAGER.readConfiguration(
                EnvironmentHelper.PropertiesToInputStream(p));
 
        // start the server to be ready to accept log messages 
        ServerThread thread = new ServerThread();
        thread.start();
        Thread.sleep(2000);
 
        h = new SocketHandler();
        assertSame(h.getLevel(), Level.parse("FINE"));
        assertTrue(h.getFormatter() instanceof MockFormatter);
        assertTrue(h.getFilter() instanceof MockFilter);