The logging request was made initially to a Logger object, which initialized the LogRecord and forwarded it here.
@param record description of the log event. A null record issilently ignored and is not published
337338339340341342343344345346347
assertSame(r, CallVerificationStack.getInstance().pop()); assertEquals("", this.errSubstituteStream.toString()); r.setLevel(Level.OFF); h.setLevel(Level.OFF); h.publish(r); assertNull(CallVerificationStack.getInstance().pop()); assertEquals("", this.errSubstituteStream.toString()); assertTrue(CallVerificationStack.getInstance().empty()); }
355356357358359360361362363364365
p.put("java.util.logging.ConsoleHandler.formatter", className + "$MockFormatter"); LogManager.getLogManager().readConfiguration( EnvironmentHelper.PropertiesToInputStream(p)); ConsoleHandler h = new ConsoleHandler(); h.publish(null); } /* * Test publish(), a log record with empty msg, having output stream */
369370371372373374375376377378379
+ "$MockFormatter"); LogManager.getLogManager().readConfiguration( EnvironmentHelper.PropertiesToInputStream(p)); ConsoleHandler h = new ConsoleHandler(); LogRecord r = new LogRecord(Level.INFO, ""); h.publish(r); h.flush(); assertEquals("MockFormatter_Head", this.errSubstituteStream.toString()); } /*
385386387388389390391392393394395
+ "$MockFormatter"); LogManager.getLogManager().readConfiguration( EnvironmentHelper.PropertiesToInputStream(p)); ConsoleHandler h = new ConsoleHandler(); LogRecord r = new LogRecord(Level.INFO, null); h.publish(r); h.flush(); // assertEquals("MockFormatter_Head", // this.errSubstituteStream.toString()); }
407408409410411412413414415416417
ConsoleHandler h = new ConsoleHandler(); assertSame(h.getLevel(), Level.FINE); LogRecord r1 = new LogRecord(Level.INFO, "testPublish_Record1"); LogRecord r2 = new LogRecord(Level.INFO, "testPublish_Record2"); assertTrue(h.isLoggable(r1)); h.publish(r1); assertTrue(bos.toString().indexOf("testPublish_Record1") >= 0); h.close(); // assertFalse(h.isLoggable(r)); assertTrue(h.isLoggable(r2)); h.publish(r2);
412413414415416417418419420421422
h.publish(r1); assertTrue(bos.toString().indexOf("testPublish_Record1") >= 0); h.close(); // assertFalse(h.isLoggable(r)); assertTrue(h.isLoggable(r2)); h.publish(r2); assertTrue(bos.toString().indexOf("testPublish_Record2") >= 0); h.flush(); // assertEquals("MockFormatter_Head", // this.errSubstituteStream.toString()); } catch (IOException e) {