At 08:55 PM 4/20/2004, Ognjen Kavazovic wrote:
Hi Ceki,

thanks for your response. My comments:

1. callerFQCN: what you said makes sense. My work around was due to the fact
that the wrapper class wasn't mine, but an Avalon Project's Log4JLogger. So
the bug is really an Avalon bug...I'll submit it to them. thanks!

Yes, submitting a bug report to Avalon is the best thing to do.


2. Level/PatternConverter: I don't really agree with coupling pattern
converters and logging levels. These two things are orthogonal, and should
remain so even with custom PatternConverters. Going back to my example, I
might want the full details at DEBUG Level. Your proposal would suggest that
I define a %lineDebug conversion word that displays the line number only
when in DEBUG mode. But then I might decide that I want full detail at INFO
Level as well just for a little while until I figure out what's going on.
Would I need to define yet another conversion word called %lineINFO in order
to do this? I shouldn't have to define a pattern converter for each
(conversion word x logging level) combination...

So with the "orthogonal" approach, a properties file might look like this:

log4j.appender.stdoutAppender.layout.ConversionPattern=[%c] - %p [%t]: %m%n
log4j.appender.stdoutAppender.layout.ConversionPattern.DEBUG=[%c] - (%F:%L)
%p [%t]: %m%n

You could pass a parameter to the extended localisation parameter. You can for example write:

log4j.appender.stdoutAppender.layout.ConversionPattern=[%c] - \
(%Fx{DEBUG}:%Lx{DEBUG}) %p [%t]: %m%n

I hope you find the above convincing.

By the way, the original problem of extracting localisation
information for DEBUG, but not INFO, for performance reasons, does
not seem to be worth the effort. Usually, one has 10 times more DEBUG
statements than INFO and higher.


Cheers,
-Ogi.

-- Ceki G�lc�

For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to