Barry,
I think that the "always" printing functionality could be of general use. There are several ways of approaching this.
1) Extending Logger (category) As you have done. Casual users are strongly discouraged from extending the Logger class. A casual user is defined as any developer who is not willing to spend the following 3 weeks dealing with the ensuing problems.
2) Add a new Level called ALWAYS. Give the ALWAYS level the highest possible value, that is Integer.MAX_VALUE, the same value as OFF. Write a wrapper for Logger class which adds the "always" methods you want. Those methods would use the ALWAYS level.
3) We, the log4j developers could, add the always methods. Whether we do this or nor depends on the opinion of the other committers/users.
I hope this helps.
At 02:58 PM 1/30/2004 -0500, Barry Sheward wrote:
Ceki,
Here is a copy of my previous email...
Hi,
We use Log4J extensively and find that sometimes we alwayswant to log a message, but the message is simply for informationalpurposes. Using Logger/Category.fatal() would potentially frightenusers, but using Logger/Category.info() may not show up if they havereconfigured logging.
While it would be possible to save the priority for thecategory, change the priority for the category, log the message andthen restore the priority for the category, this seemed veryinefficient both in terms of lines of code and run-time performance.
So, I developed the following four (incredibly simple)methods, which regardless of the current priority of theLogger/Category, will always log the message. The diff is from the1.2.8 source.
I hereby donate this code to the Apache Software Foundation.Please consider adding these methods to Log4J.
Regards,
Barry Sheward
-- Ceki G�lc�
For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
