I've been thinking about this a lot. This is one area where I'm unsure that the injection method is optimal just because of formal and de-facto standardization in this area. On one hand I *HATE* the way that log4j and java logging handle logging (especially disappointing is java logging not making the 1.5 support add varargs). I'd much prefer

String parm = "do not";
logger.log(Log.DEBUG, "I %s like cheese", parm);
(where parm is in a ... varargs http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html) to allow logging w/o ugly if(logger.debugEnabled()) type statements.

However...Using annotations helps reduce the pain of supporting multiple versions of things (unlike interfaces annotations do not have to be resolved by the classloader). Using Java logging removes the issue of versioning conflicts among multiple mailets. Moreover, a buddy of mine has written a Log4j adapter that gives the Java logging access to log4j appenders. Commons logging makes the problem of versioning conflicts worse. (A-B-C vs A-B)

So my personal preference is to just state that "use the java logging" and "mailet container providers will configure it"... For my own personal code I might add that minor varargs wrapper.

However if injection is sincerely that much more preferred here (to avoid the 1 line of startup code for logger) then field level injection is probably preferrable to setter level (and this does not preclude using Java logging BTW).

import java.util.logging.Logger;
...
@Logger
private Logger;
...

Again my preference isn't really based on any logging frameworks capabilities (if an adapter were not possible to use Log4j's massive appender library, I'd feel differently), just that it is much neater to tack this particular dependency to the JDK rather than to particular potentially conflicting releases of logging frameworks.

Thoughts?

-Andy

Norman Maurer wrote:
What about providing diffrent loggin levels for the mailets ? At the
moment we have only one logging level

bye
Norman

Danny Angus schrieb:
On 11/20/06, Andrew C. Oliver <[EMAIL PROTECTED]> wrote:
You make a good point.  Let me think about it.  I'm about midway through
coding up a draft set of annotations and interfaces + sample container
that I think encodes both your and danny's ideas with some twists of my
own.  Once I've got it to where its read I'll put it up for markup.   I
took danny's mailet-refactorings and hacked it up, tapped a build on it.
Nice one, looking forward to seeing it.
I've been side tracked a bit by work(!).

when I drop in and out take it as just low QoS
and not disengagement.
Likewise.


BTW, slightly off-topic (DSN and the effects of spam using it made me
wonder).  What do you guys think of SPF overall?
It certainly addresses a need, and done it in a sensible way.

<my 2c only, please don't flame me!...>I always expected it to be
swept up in a wave of consilidation that would take the best bits from
all of the related ideas and come up with one sensible, consistent
approach (which everyone expected marid to deliver). However from what
I saw it seemed to me as if M$ handling of PRA IPR killed off a lot of
the good-will that existed between those with alternate proposals, and
those concerned about IPR constraints fell back on SPF.</my 2c>


d.
!EXCUBATOR:1,456174ea53071579895989!




Reply via email to