logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Diehl Martin, Köln" <martin.di...@fja.com>
Subject RE: Category.log(Priority, x)
Date Fri, 10 Aug 2001 06:58:52 GMT
Hi, 

this woudl only be useful in cases the parameter is one single variable,
i.e. not an expression to evaluate and not a method call. It's not only the
"" + bMyReturnValue that should be saved with the two method approach but
mainly any evaluation that might be implicitly in the logging message.
I think thats the reason why we don't have that one method call approach.

Bye,
	Martin.

> -----Original Message-----
> From:	flyguy@null.net [SMTP:flyguy@null.net]
> Sent:	Thursday, August 09, 2001 4:25 PM
> To:	LOG4J Developers Mailing List
> Subject:	Category.log(Priority, x)
> 
> 
> Hi,
> 
> I have a function which is returning a boolean.  I would like to log all
> return values and have the logging not suck down performance.
> 
> I've noticed in the manual that it says I should do this
> 
> if (category.isInfoEnabled() )  {
>   category.log(Priority.INFO, ""+bMyReturnValue);
> }
> 
> This would avoid the parameter concatenation if Info is not enabled.  If
> log4j had a method like
> 
> log(Priority, boolean)  {
>   if (isEnabled(Priority) )  {
>     log(""+boolean);
>   }
> }
> 
> wouldn't that allow me to only have a single line in my code like
> 
> category.log(INFO, bMyReturnValue)
> 
> and have equal performance?  If so, are there any reasons that such a
> method does not exist?  or am I just be pedantic by only wanting the one
> line?
> 
> 
> Thanks,
> 
> IH
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-dev-help@jakarta.apache.org

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


Mime
View raw message