hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pfingstl Gernot" <gernot.pfing...@stmk.gv.at>
Subject Logging
Date Mon, 27 Dec 2004 14:48:06 GMT
In httpclient-3.0-beta1 source I saw, that calls to the logging api is always done directly:
	LOG.trace("some logging text");

This may produce a runtime overhead - see http://jakarta.apache.org/commons/logging/guide.html,
chapter "Best Practices (General)", "Code Guards":
"Code guards are typically used to guard code that only needs to execute in support of logging,
that otherwise introduces undesirable runtime overhead in the general case (logging disabled).
Examples are multiple parameters, or expressions (i.e. string + " more") for parameters. Use
the guard methods of the form log.is<Priority>() to verify that logging should be performed,
before incurring the overhead of the logging method call. Yes, the logging methods will perform
the same check, but only after resolving parameters."

Do you plan to refactor the above code to:
	if(LOG.isTraceEnabled())
	{
		LOG.trace("some logging text");
	}

Gernot


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


Mime
View raw message