There are a number of different ways of solving this. The most performant way will be to open a file for each component. If you know all of the components in advance you can just setup a separate appender for each in the config file. It would be sensible to differentiate between the components by the value of the logger name.
If you don't know all of the components in advance you can create appenders programmatically, each component would need to identify itself to your logging component so that it can create the appender and attach it to the Root of the current Hierarchy. Alternatively you may be able to write a custom appender that locates the right file for the component, as a starting point you may want to look at: http://cvs.apache.org/viewcvs.cgi/logging-log4net/examples/net/1.0/Appen ders/SampleAppendersApp/cs/src/Appender/PatternFileAppender.cs?rev=1.2&v iew=markup Cheers, Nicko > -----Original Message----- > From: Shaily Goel [mailto:[EMAIL PROTECTED] > Sent: 27 July 2005 14:33 > To: [email protected] > Subject: Rolling File Appender > > hi > > Our requirement is following: > > We are building a component using Log4net which logs messages > for all other components in product. It logs messages to > local logs using RollingFileAppender provided by log4net. > > Requirement is such that each component wants to log their > messages in separate local log file. > > How should we meet this requirement using log4net? > > The ideas which came to me are: > 1. For each component there should be one instance of Rolling > File Appender added. > > Is this requirement can be met in any other way? > > Thanks > Shaily > >
