You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Ron Grabowski <ro...@yahoo.com> on 2005/03/04 22:21:15 UTC

Support for "extends" attribute for appender tag in config file

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