I too in need of such functionality..

Here is a work around,

I am using DailyRollingFileAdapter, which I set from log4j.xml file. If I
change to ConsoleAppender, I guess it will not generate log files as the
output is diverted to console. 

Hope this will give a clue to you..

Thanks
Madhav

-----Original Message-----
From: Lutz Michael [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 9:40 PM
To: 'Log4J Users List'
Subject: RE: activate/ deactivate Logger with configuration file




Andreas,

My understanding is that Logger Levels are controlled by their name (the
parameter passed to the getLogger method).  It is possible to filter at the
appender level, but appenders are attached to loggers and in your case
they're the same name (because you're using the class name, which is
identical of course); thus, this won't help.

I'm thinking the answer is no, you cannot enable/disable the two calls
listed below in your code.

However, Log4j is extremely flexible.  I encourage you to state at a higher
level what you're trying to achieve, and I'll almost guarantee someone will
propose a solution meeting your needs.

Mike

PS As an idea, you could prepend different values to
"MyClass.class.getName()" - this would make the hierarchies different from
the top.  However, I suspect folks would recommend against this.



-----Original Message-----
From: Andreas Bröker [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 2:20 PM
To: [EMAIL PROTECTED]
Subject: activate/ deactivate Logger with configuration file


Hello,

i hope this is now the right group. I want to solve the following problem.
The thing i need is a different logger control. Now i use two logger to
generate logging informations. My class looks like:

...
Logger loggerOne = (Logger)getLogger(MyClass.class.getName());
Logger loggerTwo = (Logger)getLogger(MyClass.class.getName());
...
loggerOne.info("message");
loggerTwo.info("another message);
...
My, hopefully simple questions, is the folowing: Is it possible to activate,
or deactivate respectively, one of my loggers
using the log4j configuration file. Thanks for any assistance in advance.

Andreas




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

----------------------------------------------------------------------------
---
This message and any included attachments are from Siemens Medical Solutions

Health Services Corporation and are intended only for the addressee(s).  
The information contained herein may include trade secrets or privileged or 
otherwise confidential information.  Unauthorized review, forwarding,
printing, 
copying, distributing, or using such information is strictly prohibited and
may 
be unlawful.  If you received this message in error, or have reason to
believe 
you are not authorized to receive it, please promptly delete this message
and 
notify the sender by e-mail with a copy to [EMAIL PROTECTED]  Thank you

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

Reply via email to