Basically, I am using more than one appender. SMTP appender is only for
critical messages. So in JSP or HTML (GUI) I am providing option that
whether user is required these critical messages by mail or not. So if
he selected mail option then he will receive mail otherwise not. But I
am using log4j.properties file to set this option. So how this option I
will change through program? or any other way to do this...?
In a program I written as
static Logger logger = Logger.getLogger(TestLog4J.class.getName());

and directly using logger object as
logger.log(XLevel.TRACE,"DB connection not done.");

The log4j.properties file is as

log4j.rootCategory=info,RB1,EMAIL

#########################
#File Appender
#########################

log4j.appender.RB1=org.apache.log4j.FileAppender
log4j.appender.RB1.File=/tmp/log4j.log
log4j.appender.RB1.MaxFileSize=10MB
log4j.appender.RB1.MaxBackupIndex=15
log4j.appender.RB1.layout=org.apache.log4j.PatternLayout
log4j.appender.RB1.layout.ConversionPattern=[%d] [%c] [%-5p] - %m%n

########################
# SMTP Appender
#######################
                                                                                
                                                                            
#log4j.rootCategory=TRACE#log.XLevel,EMAIL
log4j.appender.EMAIL=org.apache.log4j.net.SMTPAppender
log4j.appender.EMAIL.Threshold=TRACE#log.XLevel
[EMAIL PROTECTED]
[EMAIL PROTECTED]
log4j.appender.EMAIL.Subject=ALERT MESSAGE
log4j.appender.EMAIL.SMTPHost=dns.extenprise.net
log4j.appender.EMAIL.BufferSize=1000
log4j.appender.EMAIL.layout=org.apache.log4j.PatternLayout
log4j.appender.EMAIL.layout.ConversionPattern=%d %-5p %m%n


On Tue, 2005-04-05 at 20:13, Bradley, Todd wrote:

> Maybe I don't understand your question, but wouldn't it just be
> something like this?
> 
> mySMTPAppender.close();
> 
> 
> Todd. 
> 
> > -----Original Message-----
> > From: utpal [mailto:[EMAIL PROTECTED] 
> > Sent: Tuesday, April 05, 2005 6:25 AM
> > To: log4j-user@logging.apache.org
> > Subject: How to disable log4j option using GUI?
> > 
> > Hi All,
> > I am displaying the mailing(smtp) option for log4j in GUI. I 
> > have set the smtp appender in log4j.properties file. While 
> > run time(i.e. using
> > GUI) how I can disable the smtp appender? 
> > What is the way to do this...?
> > 
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

Reply via email to