[slf4j-user] Performance and the JDK1.4 logger
Stephen Haberman
stephen at exigencecorp.com
Fri Mar 5 00:45:24 CET 2010
> Here is the report: http://bugzilla.slf4j.org/show_bug.cgi?id=72
Ah, thanks for the quick reply.
I apologize, I mistook what that bug was for--that caller data was
filled in even on disabled levels.
I guess what I'm wondering is if caller data can be filled in lazily
even for enabled levels. E.g. jdk14's Record looks like:
public String getSourceClassName() {
if (needToInferCaller) {
inferCaller();
}
return sourceClassName;
}
Where their inferCaller is slf4j's fillCallerData.
If the source class name/method name is never needed for
output/formatter, the new Throwable()/getStackElements call is avoided.
Is this worth doing in slf4j as well?
I understand the downside of lazy initializing the caller data is that
if formatting happens in a different thread than the original log call,
e.g. for batched output, then the data will be wrong. I know jdk14
logging decided this wasn't a big deal, but I realize that their
decisions are not necessarily best practice.
Thanks,
Stephen
More information about the slf4j-user
mailing list