> -----Original Message-----
> From: Bachran, Michael [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, March 18, 2002 7:54 AM
> To: Avalon-Dev (E-mail)
> Subject: ConsoleLogger inside AbstractLogEnabled (AbstractLoggable)
> 
> 
> Hi,
> 
> I got a question on the ConsoleLogger. When sometimes someone 
> forgets to set/enable the logging in a component you have to 
> spend some time finding a NPE or getLogger() returning null 
> might even affect the runtime behaviour (hopefully only 
> during testing :-)). So my question is what you think about 
> initializing the logger member inside AbstractLogEnabled 
> (AbstractLoggable) with a ConsoleLogger so that getLogger() 
> should never return null?

Honestly, we should throw a LoggerNotSetException() or something
useful like that.  If you return a NullLogger (swallows all log
events) or a ConsoleLogger (slows everything down by forwarding
events to the screen), you never report a bug to the user.

Furthermore, you are not guaranteed access to the System.out stream.

The LoggerNotSetException approach is cleaner--and forces the
developer to write correct code.  It also gives the developer
a clue as to what the real problem is.


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to