@Test public void testOpenLogFileThrowsNullPointerException() throws Throwable { RotateLogListener dailyLogListener = new DailyLogListener(); try { dailyLogListener.openLogFile(); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertNull(((DailyLogListener) dailyLogListener).f, "(DailyLogListener) dailyLogListener.f"); assertNotNull(((DailyLogListener) dailyLogListener).p, "(DailyLogListener) dailyLogListener.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; }