Java 8 LogManager - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 LogManager class.

This code example shows how to use the following methods: sleep, getProperty, readConfiguration
	/* 
	 * Test the constructor with no relevant log manager properties are set 
	 * except host and port. 
	 */ 
	public void testConstructor_NoBasicProperties() throws Exception { 
		assertNull(LOG_MANAGER.getProperty(
				"java.util.logging.SocketHandler.level")); 
		assertNull(LOG_MANAGER.getProperty(
				"java.util.logging.SocketHandler.filter")); 
		assertNull(LOG_MANAGER.getProperty(
				"java.util.logging.SocketHandler.formatter")); 
		assertNull(LOG_MANAGER.getProperty(
				"java.util.logging.SocketHandler.encoding")); 
		Properties p = new Properties();
		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 

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: addLogger, getLogger
        // test name with space 
        Logger foo = new MockLogger(FOO, null);
        Logger fooBeforeSpace = new MockLogger(FOO + " ", null);
        Logger fooAfterSpace = new MockLogger(" " + FOO, null);
        Logger fooWithBothSpace = new MockLogger(" " + FOO + " ", null);
        assertTrue(mockManager.addLogger(foo));
        assertTrue(mockManager.addLogger(fooBeforeSpace));
        assertTrue(mockManager.addLogger(fooAfterSpace));
        assertTrue(mockManager.addLogger(fooWithBothSpace));
 
        assertSame(foo, mockManager.getLogger(FOO));
        assertSame(fooBeforeSpace, mockManager.getLogger(FOO + " "));
        assertSame(fooAfterSpace, mockManager.getLogger(" " + FOO));
        assertSame(fooWithBothSpace, mockManager.getLogger(" " + FOO + " "));
    } 
 
    /* 
     * test for method public void checkAccess() throws SecurityException 
     */ 
    public void testCheckAccess() { 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: readConfiguration, reset
    final static String baseClassName = OldMemoryHandlerTest.class.getName();
    MemoryHandler handler;
 
    @Override protected void setUp() throws Exception { 
        super.setUp(); 
        manager.reset();
        initProps(); 
        manager.readConfiguration(propertiesToInputStream(props));
        handler = new MemoryHandler();
    } 
 
    @Override protected void tearDown() throws Exception { 
        super.tearDown(); 
        manager.readConfiguration();
        props.clear();
    } 
 
    public static InputStream propertiesToInputStream(Properties p) throws IOException {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        p.store(bos, "");
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getProperty
      throw new IOError(e);
    } 
  } 
 
  private static Level getLogLevelFromProperty(LogManager logManager, Level defaultLevel) {
    String levelStr = logManager.getProperty(ConsoleHandler.class.getName() + ".level");
    if (levelStr != null) {
      return Level.parse(levelStr);
    } else { 
      return defaultLevel;
    } 
  } 
 
  @VisibleForTesting 
  static OutputStreamWriter utf8OutputStreamWriter(OutputStream outputStream) {
    try { 
      return new OutputStreamWriter(outputStream, "UTF-8");
    } catch (UnsupportedEncodingException e) {
      throw new IOError(e);
    } 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: readConfiguration, reset
	/* 
	 * @see TestCase#setUp() 
	 */ 
	protected void setUp() throws Exception { 
		super.setUp(); 
		manager.reset();
		initProps(); 
		manager.readConfiguration(EnvironmentHelper
				.PropertiesToInputStream(props));
		handler = new MemoryHandler();
        errSubstituteStream = new NullOutputStream();
        System.setErr(new PrintStream(errSubstituteStream));
	} 
 
	/** 
	 * 
	 */ 
	private void initProps() { 
		props.put("java.util.logging.MemoryHandler.level", "FINE");
		props.put("java.util.logging.MemoryHandler.filter", baseClassName
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
See Code Examples for Java 8 LogManager Methods: