@Test public void testCheckSizeThrowsNullPointerException() throws Throwable { RotateLogListener rotateLogListener = new RotateLogListener(); try { rotateLogListener.openLogFile(); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertNull(ex.getMessage(), "ex.getMessage()"); assertNull(rotateLogListener.f, "rotateLogListener.f"); assertNotNull(rotateLogListener.p, "rotateLogListener.p"); } }
protected synchronized void openLogFile() throws IOException { if (f != null) f.close(); f = new FileOutputStream (logName, true); setPrintStream (new PrintStream(f)); p.println ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); p.println ("<logger class=\"" + getClass().getName() + "\">"); }
RotateLogListener extends SimpleLogListener implements Configurable, Destroyable { protected synchronized void openLogFile() throws IOException { if (f != null) f.close(); f = new FileOutputStream (logName, true); setPrintStream (new PrintStream(f)); p.println ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); p.println ("<logger class=\"" + getClass().getName() + "\">"); } }
RotateLogListener extends SimpleLogListener implements Configurable, Destroyable { protected synchronized void openLogFile() throws IOException { if (f != null) f.close(); f = new FileOutputStream (logName, true); setPrintStream (new PrintStream(f)); p.println ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); p.println ("<logger class=\"" + getClass().getName() + "\">"); } RotateLogListener(); }
RotateLogListener extends SimpleLogListener implements Configurable, Destroyable { protected synchronized void openLogFile() throws IOException { if (f != null) f.close(); f = new FileOutputStream (logName, true); setPrintStream (new PrintStream(f)); p.println ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); p.println ("<logger class=\"" + getClass().getName() + "\">"); } RotateLogListener(); void setConfiguration(Configuration cfg); synchronized LogEvent log(LogEvent ev); void logRotate(); synchronized void logRotate(boolean isStartup); void destroy(); }
RotateLogListener extends SimpleLogListener implements Configurable, Destroyable { protected synchronized void openLogFile() throws IOException { if (f != null) f.close(); f = new FileOutputStream (logName, true); setPrintStream (new PrintStream(f)); p.println ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); p.println ("<logger class=\"" + getClass().getName() + "\">"); } RotateLogListener(); void setConfiguration(Configuration cfg); synchronized LogEvent log(LogEvent ev); void logRotate(); synchronized void logRotate(boolean isStartup); void destroy(); static final int CHECK_INTERVAL; static final long DEFAULT_MAXSIZE; }