RE: Logging to separate files
There are multiple solutions, a simpler one of which is below: - create 2 loggers, each hooked with a FileAppender. - have your component log to those separate loggers. example config: log4j.rootLogger=DEBUG, log4j.logger.logger1=INFO,fileAppender1 log4j.logger.logger2=INFO,fileAppender2 log4j.appender.fileAppender1=org.apache.log4j.FileAppender log4j.appender.fileAppender1.File=file1.log log4j.appender.fileAppender2=org.apache.log4j.FileAppender log4j.appender.fileAppender2.File=file2.log -raghu -Original Message- From: Daly, Michael [mailto:[EMAIL PROTECTED]] Sent: Friday, July 19, 2002 4:55 PM To: '[EMAIL PROTECTED]' Subject: Logging to separate files I have two separate components running as part of a single app. Is there a way to have each component log to it's own log file? I have not been able to find an example of this in the docs but I think I saw it eluded to. If I have two separate apps running in the same JVM, how do I configure their logging configuration separately? Michael S. Daly MerckVaccines.com(TM) Merck Co., Inc. MVD IS Mail: WP97-A369 Phone: 215-652-4735 Pager: 1-888-621-5636 Fax:215-652-8846 E-mail: [EMAIL PROTECTED] -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. == -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Logging to separate files
How do I instruct each component to write to the correct logfile? Michael S. Daly MerckVaccines.com(TM) Merck Co., Inc. MVD IS Mail: WP97-A369 Phone: 215-652-4735 Pager: 1-888-621-5636 Fax:215-652-8846 E-mail: [EMAIL PROTECTED] -Original Message- From: Havaldar, Raghu [mailto:[EMAIL PROTECTED]] Sent: Monday, July 22, 2002 4:29 PM To: 'Log4J Users List' Subject: RE: Logging to separate files There are multiple solutions, a simpler one of which is below: - create 2 loggers, each hooked with a FileAppender. - have your component log to those separate loggers. example config: log4j.rootLogger=DEBUG, log4j.logger.logger1=INFO,fileAppender1 log4j.logger.logger2=INFO,fileAppender2 log4j.appender.fileAppender1=org.apache.log4j.FileAppender log4j.appender.fileAppender1.File=file1.log log4j.appender.fileAppender2=org.apache.log4j.FileAppender log4j.appender.fileAppender2.File=file2.log -raghu -Original Message- From: Daly, Michael [mailto:[EMAIL PROTECTED]] Sent: Friday, July 19, 2002 4:55 PM To: '[EMAIL PROTECTED]' Subject: Logging to separate files I have two separate components running as part of a single app. Is there a way to have each component log to it's own log file? I have not been able to find an example of this in the docs but I think I saw it eluded to. If I have two separate apps running in the same JVM, how do I configure their logging configuration separately? Michael S. Daly MerckVaccines.com(TM) Merck Co., Inc. MVD IS Mail: WP97-A369 Phone: 215-652-4735 Pager: 1-888-621-5636 Fax:215-652-8846 E-mail: [EMAIL PROTECTED] -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. == -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. == -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Logging to separate files
-Original Message- How do I instruct each component to write to the correct logfile? -Original Message- There are multiple solutions, a simpler one of which is below: - create 2 loggers, each hooked with a FileAppender. - have your component log to those separate loggers. example config: log4j.rootLogger=DEBUG, log4j.logger.logger1=INFO,fileAppender1 log4j.logger.logger2=INFO,fileAppender2 If I'm reading this right, a more class-oriented version of these lines could be: log4j.logger.com.mycompany.myclass=INFO,fileAppender1 log4j.logger.com.mycompany.myotherclass=INFO,fileAppender2 And you probably want to set: log4j.additivity.com.mycompany.myclass=false log4j.additivity.com.mycompany.myotherclass=false Or am I missing something here? ;) - Colin MacDonald | Software Developer | Templar Corporation | --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.377 / Virus Database: 211 - Release Date: 7/15/2002 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]