Perfect. Thanks Yoav! -----Original Message----- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 15, 2004 9:44 AM To: Log4J Users List Subject: RE: this has to be super simple: different logger, multiple appenders, for different classes
Hi, In your configuration file, define all six appenders. Call them stdout1, stdout2, email1, email2, file1, file2. The syntax for this is in the JavaDoc for the PropertyConfigurator class, as well as the Short and Complete log4j manuals. Set additivity to false for all six appenders. Maybe for stdout you want the same appender, since it's the same output stream anyways? Anyhow, then associate the logger for each class with the three appenders for it, e.g. log4j.logger.class1 = stdout1, email1, file1, DEBUG log4j.logger.class2 = stdout2, email2, file2, DEBUG And voila. If you want XML configuration or programmatic configuration, you can do that to. As your surmised, this is indeed easy and simple. Yoav Shapira Millennium Research Informatics >-----Original Message----- >From: Marc Esher (4-2060) [mailto:[EMAIL PROTECTED] >Sent: Wednesday, September 15, 2004 9:39 AM >To: [EMAIL PROTECTED] >Subject: this has to be super simple: different logger, multiple appenders, >for different classes > >All, > > This has to be so simple: I have 2 classes, and I want each of those >classes to use a different logger. Each logger will have an stdout, >email, and file appender > > > >When I call the logger for Class1, I want to say getLogger("Class1") and >then have the 3 different appenders for that logger invoked. > > > >When I call the logger for Class2, I want to say getLogger("Class2") and >then have the 3 different append for that logger invoked. > > > >How does one do this? > > > >Thanks! This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- 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]
