logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rieser, Michael (SCI TW)" <Michael_Rieser...@stercomm.com>
Subject log4j wrappers
Date Wed, 10 Mar 2004 21:33:03 GMT
In Ceki Gülcü's article _Think Again_ I read the following statements:

	A common strategy for protecting against future changes and at
	the same time to benefit from existing log4j features is to wrap
	log4j with a custom logging API. Log4j actually has support to
	facilitate such wrappers.

	Although not particularly difficult, it turns out that wrappers
	are not trivial to write. I frequently receive email where a user
	runs into a problem with their wrapper and requests help. More
	often than not, these wrappers are of doubtful quality such
	that the cost of inactive (or disabled) logging statements
	is multiplied by a factor of 1'000 (one thousand) compared to
	direct log4j usage. The most common error in wrapper classes
	is the invocation of the Logger.getLogger method on each log
	request. This is guaranteed to wreak havoc on your application's
	performance. Really!!!

I'm very interested in some of those statements.
One is "Log4j actually has support to facilitate such wrappers."
I am interested in writing a thin wrapper for Log4J for my current
client's application.  I haven't been able to find Log4J documentation
which talks about how one would plug in a wrapper.  Could someone point
me to a relevant link?

The other statement in the same vein is "The most common error in
wrapper classes is the invocation of the Logger.getLogger method on
each log request." Along with the caveat that "This is guaranteed to
wreak havoc on your application's performance. Really!!!"

What is the preferred alternative to doing that?

My thanks to Ceki for the many articles comparing log4j and
java.util.logging I've found them very interesting. It would seem that
jul could have learned a lot, by investigating log4j more closely.
I've made a decision to stick with log4j logging, but I would like to
embrace the idea of a thin wrapper to minimize the imports throughout
our code to org.apache.log4j.

Any pointers would be appreciated. (Note: I've googled, checked the short
manual, the FAQ, the JavaDocs, and the mailing list archives without
success.)

Thanks,
Mike Rieser
Java Mentor & Architect
Michael Rieser, LLC

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


Mime
View raw message