Rakesh,
You can programmatically access each Logger that you want to control
and explicitly set its logging level.
Something like:
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
public class LevelSetter {
public static void setLoggerLevel(String loggerName, Level
aLevel) {
if (LogManager.exists(loggerName)) {
Logger log = LogManager.getLogger(loggerName);
log.setLevel(aLevel);
}
}
public static void main(String[] args) {
setLoggerLevel("log4j.logger.org.springframework", Level.OFF);
setLoggerLevel("log4j.logger.org.apache.log4", Level.OFF);
}
}
I haven't tested this, but you should be able to get the basic
picture. It's pretty simple.
Best of luck.
Travis
On Oct 7, 2005, at 1:49 AM, Rakesh Patel wrote:
Errr....how?
Rakesh
-----Original Message-----
From: James Stauffer [mailto:[EMAIL PROTECTED]
Sent: 05 October 2005 20:14
To: Log4J Users List
Subject: Re: Programmatically controlling log4j
You probably don't want to turn them off but you may want to set their
level to error or fatal.
On 10/5/05, Rakesh Patel <[EMAIL PROTECTED]> wrote:
Hi,
How do I do the coding equivalent of:
log4j.logger.org.springframework=OFF
log4j.logger.org.apache.log4j=OFF
Thanks
Rakesh
American Express Investments and American Express Independent
Financial Advisers are marketing names for American Express Financial
Services Europe Limited, a separate corporation within the American
Express group of companies. American Express Financial Services
Europe Limited is authorised and regulated by, and is entered into
the
register (No. 190853 www.fsa.gov.uk/register/) of, the Financial
Services Authority and a member of the London Stock Exchange.
Registered in England No. 3614902. Registered address: 230
Blackfriars
Road, London SE1 8NW. Vat No. 740 4143 68.
The information in this email and any attachments is confidential and
intended solely for the attention and use of the named addressee(s).
It may be subject to legal, professional or other privilege and
further distribution of it is strictly prohibited without our
authority. If you are not the intended recipient, you are not
authorised to and must not disclose, copy, distribute, or retain this
message or any part of it, and should notify us immediately.
--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
American Express Investments and American Express Independent
Financial Advisers are marketing names for American Express
Financial Services Europe Limited, a separate corporation within
the American Express group of companies. American Express
Financial Services Europe Limited is authorised and regulated by,
and is entered into the register (No. 190853 www.fsa.gov.uk/
register/) of, the Financial Services Authority and a member of the
London Stock Exchange. Registered in England No. 3614902.
Registered address: 230 Blackfriars Road, London SE1 8NW. Vat No.
740 4143 68.
The information in this email and any attachments is confidential
and intended solely for the attention and use of the named addressee
(s). It may be subject to legal, professional or other privilege
and further distribution of it is strictly prohibited without our
authority. If you are not the intended recipient, you are not
authorised to and must not disclose, copy, distribute, or retain
this message or any part of it, and should notify us immediately.
---------------------------------------------------------------------
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]