I often use the same "base" appender in my config files:

<appender name="Base"
type="MyProject.Logging.AspNetRollingLogFileAppender, MyProject">
        <file value="~/Logs/Base.txt" />
        <appendToFile value="true" />
        <maxSizeRollBackups value="3" />
        <maximumFileSize value="1MB" />
        <rollingStyle value="Size" />
        <staticLogFileName value="true" />
        <layout type="log4net.Layout.PatternLayout,log4net">
        <conversionPattern value="%5p %d (%c:%L) - %m%n" />
        </layout>
</appender>

I often have 3 or more copies of that same code in my config file.
Being able to use an extends attribute on the appender tag would make
things cleaner:

<appender name="Email" extends="Base">
        <file value="~/Logs/Email.txt" />
</appender>

<appender name="Login" extends="Base">
        <file value="~/Logs/Login.txt" />
</appender>

<appender name="ShoppingCart" extends="Base">
        <file value="~/Logs/ShoppingCart.txt" />
</appender>

Is there an obvious reason why this wouldn't work or why it might be a
bad idea?

Thanks,
Ron

Reply via email to