You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Kn, Guruprasad (MED)" <Gu...@geind.ge.com> on 2002/06/12 09:18:44 UTC

How do I get a Level object from a Priority object

Hi
We were using a very old version of log4J. Recently shifted to 1.2.3.
However I am faced with a backward compatibility problem. I will try to
explain the problem as best as I can.

Priority class doc says that do not use Priority directly and use Level
instead. LoggingEvent class has a field level which gives out the Priority
object instead! Is there a way I can convert this Priority object into a
Level object. Are the integer values corresponding to the levels and
priorities the same. i.e Can I use something like
Level myLevel = Level.toLevel( Priority.INFO.toInt()); to get the Level
corresponding to INFO
I know this is a contorted way, but I dont want to do a mapping based on
case statements

Could someone please tell me if this is the only way or is there any other
elegant way to achieve the same

Thanks
Guru



"THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE
ADDRESSEE and may contain confidential and privileged information.
If the reader of this message is not the intended recipient,
you are notified that any dissemination, distribution or copy of this 
communication is strictly Prohibited. 
If you have received this message by error, please notify us 
immediately, return the original mail to the sender and delete the 
message from your system."


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>