Hi Jaikiran

Perfect! Thanks for that tip, it works great now!

For anyone else who might have this problem in future, here's what's
required:

**************************
AppenderSkeleton a
=(AppenderSkeleton)Logger.getRootLogger().getAppender("DB");
a.setThreshold(Level.toLevel("WARN"));  
**************************

Regards

Richard

-----Original Message-----
From: jaikiran pai [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 14, 2006 11:41 AM
To: Log4J Users List
Subject: Re: Changing logging level for a specific appender via code

I guess what you are looking for is setting the threshold level on the
appender. If so, then have a look at the 
   
  public  void setThreshold(Priority threshold)
   
  method on org.apache.log4j.AppenderSkeleton
   
  regards,
  -Jaikiran

"Gundersen, Richard" <[EMAIL PROTECTED]> wrote:
  Hi



I have two appenders, one called stdout, and one called DB



I would like to change the logging level of of the appender called DB,
through my Java code.



Please could someone give an example? I can use 



...logger.setLevel(...), but won't this change the level for ALL
appenders?



I was hoping that once I had the correct 'Appender' instance, there
would be a setLevel method, but there isn't. 



Sure this is due to my lack of understanding of the class hierarchy, but
if it's possible, would be grateful if someone could tell me. 



Thanks



Richard


*** Disclaimer *** 

This electronic communication is confidential and for the exclusive use
of the addressee. It may contain private and confidential information.
The information, attachments and opinions contained in this E-mail are
those of its author only and do not necessarily represent those of
London Scottish Bank PLC or any other members of the London Scottish
Group. 

If you are not the intended addressee, you are prohibited from any
disclosure, distribution or further copying or use of this communication
or the information in it or taking any action in reliance on it. If you
have received this communication in error please notify the Information
Security Manager at [EMAIL PROTECTED] as soon as possible and
delete the message from all places in your computer where it is stored. 

We utilise virus scanning software but we cannot guarantee the security
of electronic communications and you are advised to check any
attachments for viruses. We do not accept liability for any loss
resulting from any corruption or alteration of data or importation of
any virus as a result of receiving this electronic communication. 

Replies to this E-mail may be monitored for operational or business
reasons. London Scottish Bank PLC is regulated by the Financial Services
Authority.
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.

                                
---------------------------------
 Find out what India is talking about on  Yahoo! Answers India.
 So, what's NEW about the NEW Yahoo! Messenger? Find out.

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

*** Disclaimer *** 

This electronic communication is confidential and for the exclusive use of the 
addressee. It may contain private and confidential information. The 
information, attachments and opinions contained in this E-mail are those of its 
author only and do not necessarily represent those of London Scottish Bank PLC 
or any other members of the London Scottish Group. 

If you are not the intended addressee, you are prohibited from any disclosure, 
distribution or further copying or use of this communication or the information 
in it or taking any action in reliance on it. If you have received this 
communication in error please notify the Information Security Manager at [EMAIL 
PROTECTED] as soon as possible and delete the message from all places in your 
computer where it is stored. 

We utilise virus scanning software but we cannot guarantee the security of 
electronic communications and you are advised to check any attachments for 
viruses. We do not accept liability for any loss resulting from any corruption 
or alteration of data or importation of any virus as a result of receiving this 
electronic communication. 

Replies to this E-mail may be monitored for operational or business reasons. 
London Scottish Bank PLC is regulated by the Financial Services Authority.
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.

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

Reply via email to