logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jess Holle <je...@ptc.com>
Subject Re: Log4j 1.3 Woes (Partial Fix and Suggested Patch)
Date Thu, 01 Dec 2005 06:24:18 GMT
Okay, first off, I must apologize for going off half-cocked and somewhat 
rudely after running into issues earlier this week.

Secondly, I must admit that I was way offbase on some of my analysis of 
the binary compatibility issue due to:

   1. Too much haste (making waste) in trying to get the problem addressed
   2. Too much reading of the 1.3 compatibility/conversion recipes and
      not enough reading of the code, etc.
          * The docs really led me to believe that Priority and Category
            were being removed.  Nothing could be further from the
            truth, of course, when one looks at the code and examines
            binary compatibility from various angles.

That said I found the cause of the main binary compatibility issue I was 
running into (after I had addressed all source-level compatibilities):

    In log4j 1.3, Priority extends Level
        *but *in 1.2, Level extends Priority.

This flip-flop of the inheritance hierarchy avoided removing any classes 
and made things look cleaner.  Unfortunately, it drives the class 
verifier /absolutely /nuts in some cases -- at least in Java 5 Update 5, 
which is my target JVM.

I am attaching a patch that I'd like to see incorporated in log4j 1.3.  
It fixes this issue while keeping the code pretty clean as I see it.  
Yes, the Level constants move back to the Priority class, but, no, 
they're no longer repeated in both Level and Priority -- they're just 
Level objects in the Priority class.  I also made Priority abstract and 
its constructor package-private to avoid anyone creating non-Level 
Priority instances.

This would seem to clear up the most common binary compatibility issues 
I could find: those involving Level/Priority and Logger/Category.  Most 
of those I raised previously were figments of my imagination due to 
reading too much into the 1.3 recipe, but this one is quite real.

This does not address the remaining source and binary compatibility 
issues between log4j 1.2 and 1.3 -- and I'd urge the log4j community to 
round off some of these rough edges as well.  That said, I did manage to 
produce one set of source code that compiles and works with both 
versions (and now compiles against one version and runs with the other) 
and I believe the other issues will effect far fewer log4j users than 
the one addressed here.

I would also like to strongly urge a clearer statement of what is and is 
not happening in the 1.3 recipes.  Staying away from Category and 
Priority is good advice, but a little more information as to the fact 
that they're not going away, that the inheritance hierarchy is not 
changing, etc, would be helpful.

Finally, I hope to get a chance to chase the lack of appender removal 
and log level change event firings and propose patches for these issues 
as well.

Jess Holle

View raw message