@Test public void testLogThrowsNullPointerException() throws Throwable { try { Logger.log(null); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertNull(ex.getMessage(), "ex.getMessage()"); } }
public static void log (LogEvent evt) { Logger l = null; LogSource source = evt.getSource(); if (source != null) l = source.getLogger(); if (l == null && !evt.isHonorSourceLogger()) { l = getLogger(Q2.LOGGER_NAME); } if (l != null && l.hasListeners ()) { Iterator i = l.listeners.iterator(); while (i.hasNext() && evt != null) { try { evt = ((LogListener) i.next()).log(evt); } catch (ConcurrentModificationException e) { break; } catch (Throwable t) { evt.addMessage (t); } } } }
Logger implements LogProducer,Configurable { public static void log (LogEvent evt) { Logger l = null; LogSource source = evt.getSource(); if (source != null) l = source.getLogger(); if (l == null && !evt.isHonorSourceLogger()) { l = getLogger(Q2.LOGGER_NAME); } if (l != null && l.hasListeners ()) { Iterator i = l.listeners.iterator(); while (i.hasNext() && evt != null) { try { evt = ((LogListener) i.next()).log(evt); } catch (ConcurrentModificationException e) { break; } catch (Throwable t) { evt.addMessage (t); } } } } }
Logger implements LogProducer,Configurable { public static void log (LogEvent evt) { Logger l = null; LogSource source = evt.getSource(); if (source != null) l = source.getLogger(); if (l == null && !evt.isHonorSourceLogger()) { l = getLogger(Q2.LOGGER_NAME); } if (l != null && l.hasListeners ()) { Iterator i = l.listeners.iterator(); while (i.hasNext() && evt != null) { try { evt = ((LogListener) i.next()).log(evt); } catch (ConcurrentModificationException e) { break; } catch (Throwable t) { evt.addMessage (t); } } } } Logger(); }
Logger implements LogProducer,Configurable { public static void log (LogEvent evt) { Logger l = null; LogSource source = evt.getSource(); if (source != null) l = source.getLogger(); if (l == null && !evt.isHonorSourceLogger()) { l = getLogger(Q2.LOGGER_NAME); } if (l != null && l.hasListeners ()) { Iterator i = l.listeners.iterator(); while (i.hasNext() && evt != null) { try { evt = ((LogListener) i.next()).log(evt); } catch (ConcurrentModificationException e) { break; } catch (Throwable t) { evt.addMessage (t); } } } } Logger(); Configuration getConfiguration(); @Override void setConfiguration(Configuration cfg); void addListener(LogListener l); void removeListener(LogListener l); void removeAllListeners(); static void log(LogEvent evt); void setName(String name); void destroy(); synchronized static Logger getLogger(String name); String getName(); boolean hasListeners(); }
Logger implements LogProducer,Configurable { public static void log (LogEvent evt) { Logger l = null; LogSource source = evt.getSource(); if (source != null) l = source.getLogger(); if (l == null && !evt.isHonorSourceLogger()) { l = getLogger(Q2.LOGGER_NAME); } if (l != null && l.hasListeners ()) { Iterator i = l.listeners.iterator(); while (i.hasNext() && evt != null) { try { evt = ((LogListener) i.next()).log(evt); } catch (ConcurrentModificationException e) { break; } catch (Throwable t) { evt.addMessage (t); } } } } Logger(); Configuration getConfiguration(); @Override void setConfiguration(Configuration cfg); void addListener(LogListener l); void removeListener(LogListener l); void removeAllListeners(); static void log(LogEvent evt); void setName(String name); void destroy(); synchronized static Logger getLogger(String name); String getName(); boolean hasListeners(); static final String NRPREFIX; }