Sorry if I've missed the point of your email, or if any of this is super
obvious....but anyhoo.

I wrap my use of log4j up in a singleton object (implementing my interface
Logger), e.g. I do something like this:

Logger logger = Log4jLogger.getInstance();

getInstance() returns the only instance of the Log4jLogger in the following
way:

public static Log4jLogger getInstance() {
  if (_me == null) {
    _me = new Log4jLogger();
  }
  return _me;
}

The creation method is protected, so you have to use the getInstance(). In
my creation method I actually configure the log (in my case I use a
PropertiesConfigure). I would guess you'd want to initialise your appender
here and then if it fails just do a System.exit(1) and print an error to
standard error. Would'nt it be better to have a fall back position to make
your program more robust (unless the use of the SMTPappender is core to your
program naturally) - e.g. if SMTPAppender fails, perhaps use a
ConsoleAppender instead?

sam
----- Original Message -----
From: "VAYALATHU,ROY-VARGHESE (HP-Switzerland,ex1)" <[EMAIL PROTECTED]>
To: "'LOG4J Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Tuesday, July 17, 2001 8:09 AM
Subject: Appender problem. Please help


> Hello All,
> This is in continuation to my earlier mail.
> I have some important information to be logged. So I tried JMS
> appender for logging the same. My requirement is that if I can't
initialize
> the appender then I should exit the program. How can I achieve this.
> Please provide me an answer at the earliest possible.
>
> Take Care,
> Roy
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to