You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Jonathan Phillips <jp...@peopledoc.com> on 2003/04/16 15:53:13 UTC

message/value logging

The most common form of debug statements we use in our code is:

if (s_log.isDebugEnabled()) {
    s_log.debug("Here's my object at state X: " + myObject);
}

When we are not in debug mode, enclosing the debug method in the "if" test
prevents potentially performance expensive toString methods and string
concatenation.

Is there a better way to do this?

An ideal would seem to be:

    s_log.debug(String message, Object o)

that would wrap the isDebugEnabled test for me.



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Re: message/value logging

Posted by Fergus Gallagher <Fe...@OrbisUK.com>.
see 

        s_log.l7dlog(....)



On Wed, Apr 16, 2003 at 02:53:13PM +0100, Jonathan Phillips wrote:
> The most common form of debug statements we use in our code is:
> 
> if (s_log.isDebugEnabled()) {
>     s_log.debug("Here's my object at state X: " + myObject);
> }
> 
> When we are not in debug mode, enclosing the debug method in the "if" test
> prevents potentially performance expensive toString methods and string
> concatenation.
> 
> Is there a better way to do this?
> 
> An ideal would seem to be:
> 
>     s_log.debug(String message, Object o)
> 
> that would wrap the isDebugEnabled test for me.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org

-- 
Fergus Gallagher          Tel: +44 (20) 8742 1600
Orbis                     Fax: +44 (20) 8742 2649
414 Chiswick High Street  email: Fergus.Gallagher@orbisuk.com
London  W4 5TL            Web: http://www.orbisuk.com

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org