I understand now! Thanks a bunch Javier and Curt. That makes things much simpler and best part about it is that I get to delete a bunch of unneeded classes now :)
Thanks again, Mark -----Original Message----- From: Curt Arnold [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 08, 2006 1:19 PM To: Log4J Users List Subject: Re: Wrapping logger On Feb 8, 2006, at 12:47 PM, Javier Gonzalez wrote: >> >> Do you think refactoring to a less "extended" approach is a >> possibility. >> > > At first glance, I'd propose using two loggers: > > }catch(Exception ex){ > // traditional logger, with stack trace > ourLogger.fatal("Problem in such-and-such a window: ", ex); > // user friendly logger, with verbose messages and no stack > trace > ourAdvisoryLogger.fatal("The window can not display because of > xyz"); > } > > And then tweak the appenders configuration and such for > "ourAdvisoryLogger" > to get the results you had with the extended Logger. > It does sound like you have messages intended for two audiences, one set for a diagnostician and another for the user of the application. The easiest way to achieve this is to split the hierarchy of logger names and reserve a branch for the user-centric messages. The missing part of the earlier code fragment is: static Logger ourLogger = Logger.getLogger(Foo.class); static Logger ourAdvisoryLogger = Logger.getLogger("advisory"); or static Logger ourAdvisoryLogger = Logger.getLogger ("advisory.com.example.myapp.Foo"); In your configuration, you would attach an appender to the "advisory" logger that would go to your advisory window. You could set the "additivity" property on the "advisory" logger to false if you did not want the advisory messages going to the diagnosticians log assuming that it is attached to the root logger. --------------------------------------------------------------------- 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]
