logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: Common Logging Interface
Date Wed, 07 Nov 2001 18:47:49 GMT
See intermixed.

On Wed, 7 Nov 2001, Richard Sitze wrote:

> Date: Wed, 7 Nov 2001 13:32:13 -0500
> From: Richard Sitze <rsitze@us.ibm.com>
> To: Berin Loritsch <bloritsch@apache.org>
> Cc: Chris Barlock <barlock@us.ibm.com>, ceki_gulcu@yahoo.com,
>      cgiulian@tivoli.com, craigmcc@apache.org, donaldp@apache.org,
>      graham.hamilton@eng.sun.com, log4j-dev@jakarta.apache.org,
>      avalon-dev@jakarta.apache.org
> Subject: Re: Common Logging Interface
>
> Berin, I cannot help but feel you are missing my point...  Perhaps I'm
> missing yours.  Read on...
>
> Berin Loritsch wrote:
> >
> >Richard Sitze wrote:
> >>
> >> I was going to break a rule, and cross post to two different groups...
> but
> >> I cannot find an Avalon group.  So I've added a few of the major LogKit
> >> contributors, in addition to Berin (thanks for your comments to date
> >> Berin!).
> >
> >avalon-dev@jakarta.apache.org
> >
> >> OK, so LogKit has the abstraction (interface), but it's not yet inline
> with
> >> Log4J.  My overriding goal remains choice: I WANT CHOICE of a pluggable
> >> API, and I WANT YOUR SUPPORT, NOT YOUR PACKAGE AS MY ONLY OPTION!!!
> (that
> >> was podium pounding, not yelling :-)  In addition, I need a factory
> >> interface to properly abstract initialization.  See history (below) of
> this
> >> note..
> >
> >Avalon Framework has the interface.
> >As to being "inline" with Log4J, the interface merely has the client part
> of
> >the Logger interface.  Anything else is too much.  You can't guarantee the
> >same API for setting up and configuring Logging implementations.  Nor
> should
> >you.  Can you give more info on being "inline" with Log4J?
>
> I want a common interface that is *implemented* (as in Java 'class MyLogger
> implements commonLogger') by both the LogKit Logger and the Log4J
> Category/Logger classes.
>

Richard, is this an absolute requirement?  Or isn't the real goal that you
want your *application* to be able to use the abstraction layer, and then
have an adapter that plugs in to the lower level logger implementation?

For example, we're never going to be able to get the JSR-047 logger in JDK
1.4 to implement org.apache.commons.logger.Logger - but it would still be
feasible to write an adapter underneath that used it (perhaps
transparently).  We could include adapters for Log4J, LogKit, and JSR-047
in the commons package -- but you could also write an adapter for a
proprietary logging API that already existed.

To me, this is the easier problem to solve -- the harder problem is to
talk all the open source component developers into writing to the Commons
Logger APIs instead of directly to Log4J or LogKit or whatever :-).

Craig


> For LogKit this means the framework logger interface 'extends' the common
> interface, and adds its own special requirements...  The Logger class
> already extends the framework interface, which is goodness.  Your interface
> is an excellent starting point!
>
> For Log4J this means that the Category/Logger classes 'implement' the
> common interface.
>
> Now, for this to occur there are going to be changes to the classes, which
> is what I describe below.
>
> >
> >Avalon Framework does give you the choice of which Logging implementation
> you
> >want.
>
> Yes, as wrappers.  One of the major hangups we keep stumbling into is that
> we end up with wrappers of wrappers of wrappers...  We have two code bases
> that are SO close to a common interface, which has 0 (zero) overhead if a
> 'implements' the interface, rather than wrapping to another interface.
>
> >
> >> Choice is important (this is open-source, remember!) to minimize
> multiple
> >> configuration points and multiple log files in an enterprise application
> >> (multiple middleware solutions, multiple applications, all trying to
> work
> >> together.. in a distributed environment..).  See history (below) for
> more
> >> details..
> >>
> >> Finally, I believe that the changes are minimal.
> >>
> >> To repeat earlier points and address the new LogKit interface, the
> >> differences that I see between LogKit and Log4J are:
> >>
> >> a.  LogKit::fatalError versus Log4J::fatal.
> >
> >Using the Avalon Framework Logger interface, they both become
> Logger::fatalError().
> >In fact it also works for JSR47::serious().
>
> wrappers... not good enough :-)
>
> >
> >> b.  Log4J lacks isXXXEnabled() methods.  I would prefer not to introduce
> an
> >> isEnabled(Level) method to the interface, and I understand that JSR47
> will
> >> not be able to implement the interface directly, but will require a
> >> wrapper.
> >
> >The Avalon Framework Logger interface has the isXXXEnabled() methods
> accross the
> >board.  For the ones not available in Log4J, the wrapper uses the
> isEnabled(Level).
>
> Which is why you didn't see me proposing a change for LogKit on this point
> below...
>
> >
> >> c.  LogKit parameters are java.lang.String, whereas Log4J uses
> >> java.lang.Object.
> >
> >Do you _really_ every log anything else other than strings?  For objects,
> you would
> >simply perform a Object.toString() on it.
>
> In practice, I don't care.  However, moving Log4J to java.lang.String is
> going to be harder than (for backwards compatibility) than moving LogKit to
> an object.
>
> >
> >> d.  LogKit org.apache.avalon.framework.logger.Logger interface
> introduces
> >> getChildLogger(String name)
> >
> >The default implementation for the Log Tools that don't support the notion
> >of Child Loggers (instead of ParentLoggers), we use dot notation for the
> child.
> >
> >e.g.
> >
> >return Category.getInstance(logger.getName() + "." + childName);
> >
> >So you still have the same effective interface.
>
> I agree.  Once we have a simple interface there are many obvious
> extensions...  but I want to address the core problem first.  In light of
> your example I would not be adverse to a 'getName()' method in the common
> interface...
>
> >
> >> I'm willing to do the work to establish a common logging interface, but
> it
> >> must be coordinated.  Clearly I need to know that it's going to be
> accepted
> >> before I start.  To make this happen, I need a coordinated VOTE from:
> >>
> >> A.  Apache/Jakarta development leaders (common code?)
> >> B.  Log4J development team (I can do work, I need support).
> >> C.  LogKit development team (again, I'd be happy to do work, but I need
> >> support).
> >>
> >> For Apache/Jakarta common code (craig, can you help with logistics
> here?),
> >> I propose the following (I'm not attached to names):
> >>
> >>      Apache.1: Copy the org.apache.avalon.framework.logger.Logger
> >>                interface to org.apache.common.logger.Logger (?).
> >
> >If this happens, make the package name shorter.  Honestly, I like the
> Avalon
> >Logger package, and I do not want something that exposes the whole Logger
> >Heirarchy.
>
> I'm trying to abstract the hierarchy and the avalon framework...
> If you want LogKit - use it.  What I'm trying to do is 'enable' those who
> want a pluggable solution that works DIRECTLY with Log4J and LogKit, but
> also supports wrappers for other solutions.
>
> >
> >>      Apache.2: Remove getChildLogger(String name) from
> >> org.apache.common.logger.Logger.
> >
> >-10.  It is common in Avalon programming to get a child logger and hand it
> >      to a group of Components that the Container is managing.  It makes
> the
> >      interface simple, and keeps the child from circumventing the
> Inversion
> >      of Control principles that Avalon is designed around.
>
> I'm removing from the org.apache.common.logger.Logger, but leaving it in
> org.apache.avalon.framework.logger.Logger.  That should satisfy your
> concerns.
>
> >
> >>      Apache.3: Change logging method parameters from java.lang.String
> >>                to java.lang.Object.
> >
> >-0  Honestly, in the end, you are logging Strings.  Period.  If you really
> want
> >    to "log" Objects, knock yourself out.
>
> See above.
>
> >
> >>      Apache.4: More to come on factory, but that's incidental if I can
> get
> >>                all of this done first.
> >
> >Avalon Excalibur has a LogKit Factory that is both powerful and easy to
> extend.
> >It can be modified to allow multiple Log tools relatively easily.
>
> Terrific, can we use it as a basis...
>
> >
> >> I propose that the LogKit group VOTE on the following (as a unit)
> changes
> >> to the org.apache.avalon.framework.logger.Logger interface:
> >>
> >>      LogKit.1: Cause interface to extend
> org.apache.common.logger.Logger.
> >
> >This is possible.
> >
> >>      LogKit.2: Remove logging methods in common with
> >>                 org.apache.common.logger.Logger (they inherit..).
> >>
> >>                 This effectively changes parameter types from
> >>                 java.lang.String to java.lang.Object, which should
> >>                 be backward compatible.
> >>
> >>      LogKit.3: Leave getChildLogger(String name) as a method unique
> >>                 to the framework...
> >
> >Honestly, if you get different loggers another way I don't like it.
> >The reason being is that you open yourself up to Spoofing attacks
> >if you have code that automatically loads and uses components.  If
> >you get a rogue component that wants to retrieve Logging calls from
> >the rest of the system, it has access to the whole logging heirarchy.
> >This is not good.  Bear in mind that Logging has alot of precious
> >information that a Hacker can use to determine weaknesses in a system.
> >
> >I prefer a system that minimizes the impact of such rogue Components
> >as possible.  This is critical in a server framework which Avalon caims
> >to be.
>
> I believe I can spoof Log4J simply by adjusting configuration files and
> adding my own handlers to the path... I imagine something similar can be
> done with LogKit.  what am I missing here?
>
> >
> >
> >
> >--
> >
> >"Those who would trade liberty for
> > temporary security deserve neither"
> >                - Benjamin Franklin
> >
> Indeed!
>
>
> <ras>
>
>


--
To unsubscribe, e-mail:   <mailto:log4j-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-dev-help@jakarta.apache.org>


Mime
View raw message