Yep - absolutely correct - doing a getLogger().error( "xyz" ) is
perfectly ok.  Doing the isErrorEnabled() test allows you to check that
an error level is enabled before constructing an error message. In my
example the error message is so simply that it does not matter however,
good error messages should be packed with context and that typically
means an expensive string construction process before invoking 

   getLogger().error( myExcensiveString ); 

The second benefit of getting into the habit of creating the string
outside of the invocation call is that it makes it a lot easier to
update things later with i18n derived strings.

Cheers, Steve.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 21, 2004 2:32 AM
To: Avalon framework users
Subject: RE: Handling exceptions

|---------+---------------------------->
|         |           "Stephen         |
|         |           McConnell"       |
|         |           <[EMAIL PROTECTED]|
|         |           .org>            |
|         |                            |
|         |           20/07/2004 06:22 |
|         |           PM               |
|         |           Please respond to|
|         |           "Avalon framework|
|         |           users"           |
|         |                            |
|---------+---------------------------->
 
>-----------------------------------------------------------------------
---------------------------------------|
  |
|
  |       To:       "'Avalon framework users'" <[EMAIL PROTECTED]>
|
  |       cc:
|
  |       Subject:  RE: Handling exceptions
|
  |Classification:  |-------------------|
|
  |                 | ( ) In-Confidence |
|
  |                 | ( ) Unclassified  |
|
  |                 |-------------------|
|
  |
|
 
>-----------------------------------------------------------------------
---------------------------------------|












   If( getLogger().isErrorEnabled() )
   {
       final String error =
         "My deep and meaningful error message.";
       getLogger().error( error );
   }

<REPLY>
If I remember correctly, the above is equivalent to

getLogger().error( "My deep and meaningful error message." );

The logger internally checks whether isErrorEnabled (at least LogKit
and Log4J did this). Is there something different in its implementation
under Merlin?


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








****************************************************************
NOTICE - This message is intended only for the use of the 
addressee named above and may contain privileged and 
confidential information.  If you are not the intended recipient
of this message you are hereby notified that you must not 
disseminate, copy or take any action based upon it.  If you 
received this message in error please notify HIC immediately.
Any views expressed in this message are those of the individual
sender, except where the sender specifically states them to be
the views of HIC.
****************************************************************


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




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

Reply via email to