I am creating a custom filter in log4net. I found that I can map the elements in the config to the properties in the filter class as follows:
<filter type="ConsoleApplication1.CustomFilter">
<FooKey value="FooValue"/>
</filter>
public class CustomFilter : FilterSkeleton
{
public string FooKey { get; set; }
public override FilterDecision Decide(LoggingEvent loggingEvent)
{
return FilterDecision.Accept;
}
}
What I would like to do is set up a list of these elements:
<filter type="ConsoleApplication1.CustomFilter">
<FooKey value="FooValue"/>
<FooKey value="BarValue"/>
</filter>
public class CustomFilter : FilterSkeleton
{
public string[] FooKeys { get; set; }
public override FilterDecision Decide(LoggingEvent loggingEvent)
{
return FilterDecision.Accept;
}
}
If possible, how would I do it?
source
share