logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Davis <...@netstorm.net.au>
Subject Re: Comments on JSR47
Date Tue, 12 Jun 2001 03:33:03 GMT
Ceki Gülcü wrote:
> 
> Geoff,
> 
> My first and foremost criticism on the JSR47 API is the lack of any 
> provision for pluggability. The LogManger can be set at application 
> initialization time but not the type (class) of the Logger to be used. 

My understanding here is that the lead expert for the JSR-000047, who is now
the Chief Technologist - Java, Sun, places abstract classes before interfaces
in a design sense.  By doing so, implementors of Loggers are forced to inherit
implementation and subsequently are forced into supporting existing behaviour.

Had the logging API borrowed from Swing for example:

    TableModel              Interface
    AbstractTableModel      Abstract implementation of TableModel
    DefaultTableModel       Default concrete implementation of TableModel

Where the swing code uses the interface TableModel as the contract between a 
table model and the user of a table model, then the logging API would have
been far more flexible and supported pluggability to a greater degree.

> 
> Logger should become an interface allowing a user-chosen implementation to 
> be returned from an abstract factory, as in:
> 
>   Logger logger = LogFactory.getLogger("some name");
> 
> Only the LogFactory should be concerned with the Logger and LogManager 
> instances to return to the user.
> 
> I am also in perfect agreement with the criticism voiced by Greg Davis 
> at http://www.swzoo.org/documents/miscellaneous/jsr047/ in particular 
> with points 1,2 and 4.
> 
> Having attentively read java.util.logging.*, I can say that there are 
> many ailments in the API. However, the lack of pluggability is what 
> worries me most. 

I agree.  There are indeed many ailments.  And having worked on a number of
large Java projects where I have had to extract a "poor" homegrown logging 
API, I feel I can spot a poor logging API.  java.util.logging as it stands
is definitely one of these :-(

> 
> Regards,  Ceki Gülcü
> 
> ps: It also seems that no part of JDK 1.4 is using the newly introduced 
> logging API. Does this mean that there is still hope to influence the API?

I've had a look at the source too and I see no "use" of java.util.logging.
in the other java packages.  It would be great (understatement) if we could 
get to java.util.logging before it becomes too wide spread.

I've noticed an incredible amount of inertia from people who don't know a lot
about logging but know they need it.  The comments usually go something like:

    "Why should I use <other logging package> when there is a
     logging package in JDK1.4".

This endorses a "poor" API way beyond what it deserves.

Best Regards,

Greg.


-- 
Greg Davis                           NETSTORM
19 Ascog Tce                         ACN 075-186-293
Toowong                              http://www.netstorm.net.au
Brisbane                             mag@netstorm.net.au
QLD 4066                             +61 7 37208855

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


Mime
View raw message