public synchronized LogEvent log (LogEvent ev) { if (p != null) { ev.dump (p, ""); p.flush(); } return ev; } }
public synchronized LogEvent log (LogEvent ev) { org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger ( ev.getRealm().replace('/', ':') ); if (logger.isEnabledFor ( _level)) { ByteArrayOutputStream w = new ByteArrayOutputStream (); PrintStream p = new PrintStream (w); ev.dump (p, ""); logger.log (_level, w.toString()); } return ev; } }
public String toString(String indent) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream p = new PrintStream (baos); synchronized (getPayLoad()) { dump(p, indent); } return baos.toString(); } public String toString() {
public LogEvent log (LogEvent evt) { if (ui.isDestroyed ()) { SwingUtilities.invokeLater (this); return evt; } ByteArrayOutputStream str = new ByteArrayOutputStream(); PrintStream ps = new PrintStream (str); evt.dump (ps, ""); text.insert (str.toString(), 0); if (++cnt % maxEvents == 0) { SwingUtilities.invokeLater (this); } return evt; } }
public synchronized LogEvent log(LogEvent ev) { if (p != null && permitLogging(ev.getTag())) { Date d = new Date(); p.println( "<log realm=\"" + ev.getRealm() + "\" at=\"" + d.toString() + "." + d.getTime() % 1000 + "\">" ); ev.dump(p, " "); p.println("</log>"); p.flush(); } return ev; } }
public synchronized LogEvent log(LogEvent ev) { if (p != null) { Date d = new Date(System.currentTimeMillis()); // if (ansi) // cli.getOutputStream().write(1); // BOLD cli.println( ev.getSource().getLogger().getName() + ": " + ev.getRealm() + " " + d.toString() + "." + d.getTime() % 1000 ); ev.dump(p, " "); // if (ansi) // cli.getOutputStream().write(0); // OFF p.flush(); } return ev; }
p.print(indent); } else if (value instanceof LogEvent) { ((LogEvent) value).dump(p, indent); p.print(indent); } else if (value != null) {
@Test public void testDump() throws Throwable { PrintStream p = new PrintStream(new ByteArrayOutputStream()); new LogEvent("testLogEventTag").dump(p, "\r\n"); assertTrue("Test completed without Exception", true); }
@Test public void testDump2() throws Throwable { LogEvent logEvent = new LogEvent("testLogEventTag", null); logEvent.addMessage("testString", "1s"); PrintStream p = new PrintStream(new ByteArrayOutputStream()); logEvent.dump(p, "testLogEventIndent"); assertTrue("Test completed without Exception", true); }
@Test public void testDump1() throws Throwable { LogEvent logEvent = new LogEvent("testLogEventTag"); logEvent.addMessage("testString", "testString"); PrintStream p = new PrintStream(new ByteArrayOutputStream()); logEvent.dump(p, "testLogEventIndent"); assertTrue("Test completed without Exception", true); }
ByteArrayOutputStream buf = new ByteArrayOutputStream(); PrintStream p = new PrintStream (buf); ev[i].dump (p, ""); p.close();
@Test public void testDump3() throws Throwable { new LogEvent(new ThreadPool(0, 0), "testString", null).dump(new PrintStream(new ByteArrayOutputStream(), true), "a42"); assertEquals("\"a42\"", "a42", "a42"); }
@Test public void testDumpThrowsNullPointerException() throws Throwable { try { new LogEvent("testLogEventTag").dump(null, "testLogEventIndent"); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertNull("ex.getMessage()", ex.getMessage()); } }