logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DJohn...@desknetinc.com
Subject RE: Priority.getAllPossiblePriorities() bug reported yet?
Date Wed, 09 Apr 2003 17:37:09 GMT
Actually, it doesn't help in this case.  The reason it doesn't is that 
there is no equals() method of Level which would allow the expression 
"Level.ERROR.equals(Priority.ERROR)" to evaluate as true.  Since I was 
using the returned list of priorities as keys to a Map, and then 
attempting to later perform a lookup in that map using the Level from a 
LoggingEvent, the fact that Level.INFO is not the same object as 
Priority.INFO becomes significant.
Yoav's suggestion for changing getAllPossiblePriorities would work, but it 
would be disruptive of existing code, which I assume is the reason for 
deprecating instead of removing the method immediately.  The smoothest 
transition would be afforded by implementing a good equals() method in 
Level.



Please respond to "Log4J Users List" <log4j-user@jakarta.apache.org>
To:     "Log4J Users List" <log4j-user@jakarta.apache.org>
cc: 
Subject:        RE: Priority.getAllPossiblePriorities() bug reported yet?




David,

As Yoav said, the method Priority.getAllPossiblePriorities() is likely to
disappear some time in the future. Moreover, if you look closely in the
code of Priority.java class, you will see that all the static "priorities"
are actually of type Level. Does this help?

At 09:34 AM 4/9/2003 -0400, you wrote:

>Howdy,
>I couldn't find such a bug in Bugzilla, so feel free to enter it if you
>want ;)  (Of course, even I did find something you could still feel free
>to enter another ;))
>
>However, I would point out the method javadoc says it will return an
>array of Level objects.  So I disagree with your interpretation of the
>bug.  A possible fix might be
>Priority[] getAllPossiblePriorities() {
>   Return new Level[] {Level.FATAL, ...};
>}
>
>And regardless, I would caution you not to rely on this method as I
>doubt it'll be around in log4j 1.3.
>
>Yoav Shapira
>Millennium ChemInformatics
>
>
> >-----Original Message-----
> >From: DJohnson@desknetinc.com [mailto:DJohnson@desknetinc.com]
> >Sent: Wednesday, April 09, 2003 9:12 AM
> >To: log4j-user@jakarta.apache.org
> >Subject: Priority.getAllPossiblePriorities() bug reported yet?
> >
> >I just discovered that Priority.getAllPossiblePriorities() in 1.2.8 is
>not
> >only deprecated, but broken.  A quick search in bugzilla gave me
>nothing,
> >but I don't have enough faith in my skills there to be sure...  Before
>I
> >enter this in bugzilla, has anyone else already reported it?  The bug
>is
> >using Level.WARN instead of Priority.WARN, as you can see below.
> >  Priority[] getAllPossiblePriorities() {
> >    return new Priority[] {Priority.FATAL, Priority.ERROR, Level.WARN,
> >                           Priority.INFO, Priority.DEBUG};
> >  }
> >
> >__________________________________________________________________
> >David S. Johnson

--
Ceki  For log4j documentation consider "The complete log4j manual"
http://www.qos.ch/shop/products/clm_t.jsp


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




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message