Can this be solved with the class below? it gives one line of logging.
MyOneLineLogger.debug(log, "boo", "far"); public class MyOneLineLogger { public static debug(Logger log, Object mess1, Object mess2) { if (log.isDebugEnabled()) { log.debug(new StringBuffer(mess1).append(mess2)); } } //etc } -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, January 21, 2005 8:33 AM To: Log4J Users List Subject: Re: RE: Wish for CVS version: if debug enabled() > It must be said that the quality of the original proposal lacked > precision and was in quite poor form in general. I'd appreciate if a > cleaner and more precise proposal were submitted. These are the methods I would have liked to have seen in Category/Logger. However I see there is conflict with the new messageFormat version. Maybe it is too late to propose this. void debug(Object mess1, Object mess2) { if (isDebugEnabled()) { debug(new StringBuffer(mess1).append(mess2)); } } void debug(Object mess1, Object mess2, Object mess3) { if (isDebugEnabled()) { debug(new StringBuffer(mess1).append(mess2).append(mess3)); } } void debug(Object mess1, Object mess2, Object mess3, Object mess4) { if (isDebugEnabled()) { debug(new StringBuffer(mess1).append(mess2).append(mess3).append (mess4)); } } void debug(Object mess1, Object mess2, Object mess3, Object mess4, Object mess5) { if (isDebugEnabled()) { debug(new StringBuffer(mess1).append(mess2).append(mess3).append (mess4).append(mess5)); } } etc... (but where to end) This would allow code such as this in an application - String value = (String)myMap.get(key); if (log.isDebugEnabled()) { log.debug("Got the value " + value + " from the map with key " + key); } to be reduced down to - String value = (String)myMap.get(key); log.debug("Got the value ", value, " from the map with key ", key); removing the clutter from the application code. The program flow of my code then shows my application program flow not logging program flow. I can see that the same can be achieved using the message format debug but I like the fact that the text in my example still reads from left to right. I think it adds clarity. Regards Bob. ----------------------------------------- Email provided by http://www.ntlhome.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]