I postd a feature request for this:

 http://issues.apache.org/jira/browse/LOG4NET-20

Dag Christensen was kind enough to write a patch for 1.2.0 beta 8 that
never got applied before 1.2.9 beta came out.

If you have any ideas on this could be accomplished post your comments
to the issue. The dev mailing list automatically receives a copy of
your comment.

- Ron

--- Marco von Frieling <[EMAIL PROTECTED]> wrote:

> Hello.
> 
> Is it possible to inherit from another appender configuration in the
> log4net
> configuration file? We use some appenders of same type and with same
> configuration, excepting one or two properites and so it would be
> nice if
> there is an simple inheritance mechanism to shorten the xml config
> code. 
> 
> I'll give you an example what the xml should look like:
> 
> <appender name="RollingLogFileAppenderBase"
> type="log4net.Appender.RollingFileAppender">
>       <appendToFile value="true" />
>       <rollingStyle value="Composite" />
>       <datePattern value="yyyyMMdd" />
>       <maxSizeRollBackups value="10" />
>       <maximumFileSize value="1MB" />
>       <layout type="log4net.Layout.PatternLayout">
>               <conversionPattern value="%date [%thread] %-5level %logger
> [%property{NDC}] - %message%newline" />
>       </layout>
> </appender>
> <appender name="MainRollingLogFileAppender"
> inherits="RollingLogFileAppenderBase">
>       <file value="c:\\MyProduct\Logs\MyProduct.log" />
> </appender>
> <appender name="AssemblyRollingLogFileAppender"
> inherits="RollingLogFileAppenderBase">
>       <file value="c:\\MyProduct\Logs\MyInterestingAssembly.log" />
> </appender>
> <appender name="ErrorClassRollingLogFileAppender"
> inherits="RollingLogFileAppenderBase">
>       <file value="c:\\MyProduct\Logs\MyNewClass.log" />
>       <layout type="log4net.Layout.PatternLayout">
>               <conversionPattern value="%date %-5level [%property{NDC}] -
> %message%newline" />
>       </layout>
> </appender>
> 
> The MainRollingLogFileAppender will be used by the root logger with
> level
> INFO, the other appenders by special loggers which have some filters
> defined
> like logger name etc. Their additivity flag is set to false. So what
> would
> this config do (expected by us):
> 
> The MainRollingLogFileAppender is loaded for the root logger. It
> inherits
> the RollingLogFileAppenderBase which has a type definition. An
> instance of
> this type is created and set up with the base configuration. Now the
> configurator goes up one level and adds this config. I a value is
> still set,
> it will be overwritten, e. g. the layout of
> ErrorClassRollingLogFileAppender.
> 
> If this isn't possible in the latest version, please treat this as
> feature
> request.
> 
> Kind regards
> 
> Marco von Frieling
> 
> -- 
> Marco von Frieling
> In den Ackern 8
> D-27374 Wittorf
> 
> eMail: [EMAIL PROTECTED]
> 
> Telefonieren Sie schon oder sparen Sie noch?
> NEU: GMX Phone_Flat http://www.gmx.net/de/go/telefonie
> 

Reply via email to