May be you should set the explicit rootCategory to say what appender it
would use. I am not sure what happens when the rootCategory is not set.


Swami

> -----Original Message-----
> From: Ashwin Bangalore [mailto:[EMAIL PROTECTED]]
> Sent: April 26, 2002 1:40 PM
> To: [EMAIL PROTECTED]
> Subject: Log4j writes to multiple log files (Additivity problems?)
> 
> 
> Hello Log4J Gurus,
> 
> I have a bit of a problem with Log4J writing into multiple log files.
> I searched the mailing list for a similar problem/solution but I've
> either missed it somewhere or didn't find an exact problem posted.
> I did read the fine manual, How-to and the troubleshooting guide also.
> *grin*
> 
> Let me explain a little about what I'm trying to do:
> I have three classes GrandParent, Parent and Child. All three of them
> are individually configured and write to their own log files.
> The additivity of all the three are explicitly set to false.
> The problem is that if the Child writes a log entry, the 
> entry is written
> to all the three log files - Child.log, Parent.log and 
> GrandParent.log.
> 
> I know I'm goofing up somewhere in defining categories, but I 
> just can't
> figure out where. Can someone please help me troubleshooting 
> this problem?
> 
> Will the fact that I have aliased MyFileAppender thrice play a part in
> writing multiple times? I can give you more details about the extended
> classes if anyone requires.
> 
> Pardon me if this has been answered before and kindly point me to
> the correct resources.
> 
> Thanks for your help.
> 
> Ashwin.
> 
> My log4j.properties looks something like this:
> ============Begin Properties file=========================
> log4j.appender.SyslogAppender=com.abc.sle.logging.SLESyslogAppender
> log4j.appender.SyslogAppender.Threshold=FATAL
> 
> log4j.appender.default=com.abc.sle.logging.MyFileAppender
> log4j.appender.GParentAppender=com.abc.sle.logging.MyFileAppender
> log4j.appender.ParentAppender=com.abc.sle.logging.MyFileAppender
> log4j.appender.ChildAppender=com.abc.sle.logging.MyFileAppender
> 
> log4j.appender.default.layout=org.apache.log4j.PatternLayout
> log4j.appender.GParentAppender.layout=org.apache.log4j.PatternLayout
> log4j.appender.ParentAppender.layout=org.apache.log4j.PatternLayout
> log4j.appender.ChildAppender.layout=org.apache.log4j.PatternLayout
> 
> log4j.appender.default.layout.ConversionPattern=[%p] %d %m %n
> log4j.appender.GParentAppender.layout.ConversionPattern=[%p] %d %m %n
> log4j.appender.ParentAppender.layout.ConversionPattern=[%p] %d %m %n
> log4j.appender.ChildAppender.layout.ConversionPattern=[%p] %d %m %n
> 
> log4j.appender.default.Append=true
> log4j.appender.GParentAppender.Append=true
> log4j.appender.ParentAppender.Append=true
> log4j.appender.ChildAppender.Append=true
> 
> log4j.appender.default.File=default.log
> log4j.appender.GParentAppender.File=GParent.log
> log4j.appender.ParentAppender.File=Parent.log
> log4j.appender.ChildAppender.File=Child.log
> 
> log4j.category.default=DEBUG, default, SyslogAppender
> log4j.category.GParent=DEBUG, GParentAppender, SyslogAppender
> log4j.category.Parent=DEBUG, ParentAppender, SyslogAppender
> log4j.category.Child.DEBUG, ChildAppender, SyslogAppender
> 
> log4j.additivity.category.default=false
> log4j.additivity.category.GParentAppender=false
> log4j.additivity.category.ParentAppender=false
> log4j.additivity.category.ChildAppender=false
> 
> ====================== End Properties File =======================
> 
> Notes:
> MyFileAppender is a simple extension of org.apache.log4j.FileAppender
> SyslogAppender is a simple extension of AppenderSkeleton. 
> Calls a custom
> Syslog API also written in Java.
> 
> 
> --
> 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]>

Reply via email to