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: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]