At 16:16 24.05.2002 +0200, Wolf Siberski wrote: >Log4j seems to be already on the way to provide the same API as the >1.4 java.util.logging package (introduction of Logger and Level, >deprecation of Category and Priority). >Logger and Level classes are nearly compatible to its java.util.logging >counterpart, but there are some methods and constants which currently >have different names: >isLoggable() vs. isEnabledFor() >severe() vs. error() >warning() vs. warn() >The same applies to Level: >SEVERE vs. ERROR >WARNING vs. WARN
Introducing isLoggable(), severe(), and warning() seems easy enough. Adding new levels SEVERE and WARNING is a diffent matter. For example, if the SEVERE level has the same integer value as ERROR but a different String representation, when transmitted across the wire, it will go in as SEVERE and come out as ERROR. This is bound to confuse users. Preventing such minor inconsistencies is not so trivial. Moreover, Level.SEVERE and Level.WARNING object are rarely referenced directly. Yes? Adding the isLoggable(), severe() and warning() methods will facilitate the migration at minimal cost. What do others think? >My suggestion is to add these methods and constants to the Log4J API. >This would allow to write logging code which would be indistinguishable >between Log4j and java.util.logging except the import statments. >This is a good thing because >- people worrying about being locked-in to a proprietary API > could be convinced to use Log4j, because switching to the > 'standard' API would come with near-zero cost. >- people starting with java.util.logging and discovering Log4j > later could switch to Log4j with near-zero cost as well. >I can't see any significant disadvantages. > >Note that I only propose to adapt the *logging* interface to >the java.util.logging API. Configuration, Filtering and Output >is so much more advanced in Log4j that IMHO it doesn't make sense >to even think about adaptation. Agreed. >A minor issue: I noticed that getChainedPriority() is deprecated now, >and there seems to be no replacement for it. I'd like to see >a new method getChainedLevel() as replacement. I am somewhat surprised by this question. The getChainedPriority has been replaced with getEffectivelevel. This is fully documented: http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/Category.html#getChainedPriority() Have you missed it? Was there something unclear about the javadocs? >Wolf -- Ceki -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>