> -----Original Message----- > From: None None [mailto:[EMAIL PROTECTED]
> I already have a logger setup to send e-mails when "FATAL" > errors occur. But I also want to send e-mail on some specific > occasions ;) Like starting and stopping an application. To do > this I need to define a custom level. The problem is that the > samples provided for the custom level dont offer any > explanation on how to implement the logger class. Unless > there is a better way? Hi, I was starting doing a custom level but then I preferred the more light approach suggested from Yoav Shapira some time ago on this list. For me was perfect. Here there is the message: > -----Original Message----- > From: Shapira, Yoav [mailto:[EMAIL PROTECTED] > Sent: Friday, September 17, 2004 1:59 PM > To: Log4J Users List > Subject: RE: Custom Levels > > > Hi, > I can't help with your actual problem, as I don't know its > cause, but I wanted to offer an alternative approach that > involves much less work for you. > > Use an Admin Logger as a separate Logger, rather than a > separate level. > Have a Singleton in your webapp which has > > private static final Logger ADMIN_LOGGER = > Logger.getLogger("MYAPP_ADMIN_LOGGER"); > > public static Logger getAdminLogger() { > return ADMIN_LOGGER; > } > > or maybe > public static void warnAdmin(...) { > ADMIN_LOGGER.warn(...); > } > etc. > > The main advantage of this approach is that you don't need to > write a custom Level, a custom Logger, or a LoggerFactory. > In addition, you still maintain clean separation of logging > output for admin from other logging output. You can still > configure whatever appenders (and thresholds, and renders, > etc.) you want just for the admin logger. All your classes > can access it with negligible overhead via the singleton. > Much simpler, more streamlined than your approach, I think. > But it's just a suggestion, feel free to ignore it ;) > > Yoav Shapira > Millennium Research Informatics > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
