Enterprise Library, Logging Application Block, Custom Filter  
Author Message
Gavin Clements





PostPosted: Visual C# General, Enterprise Library, Logging Application Block, Custom Filter Top

The documentation states that to create a custom Log Filter, I need to derive a class from LogFilter which " ... must also have CustomLogFilterData as the type specified as the value for the ConfigurationElementType attribute"

However, the attribute ConfigurationElementType does not exist in the namespace "Microsoft.Practices.EnterpriseLibrary.Logging.Filters".

When I try to setup the Filter in Enterprise Library Configuration, it says there is no class inheriting from LogFilter in my assembly, and I presume it's because of this missing attribute.

Does anybody know where the attribute can be found



Visual C#10  
 
 
Sagitt





PostPosted: Visual C# General, Enterprise Library, Logging Application Block, Custom Filter Top

Namespace: Microsoft.Practices.EnterpriseLibrary.Common.Configuration 
 
Assembly: Microsoft.Practices.EnterpriseLibrary.Common (in microsoft.practices.enterpriselibrary.common.dll) 

 
 
Gavin Clements





PostPosted: Visual C# General, Enterprise Library, Logging Application Block, Custom Filter Top

Thanks, Sagitt, for your reply.

Still having trouble with Custom Filters, though. I have implemented my Filter class as follows:

[ConfigurationElementType(typeof(CustomLogFilterData))]

public class CarbonLogFilter : LogFilter

{

public CarbonLogFilter(string name)

: base(name)

{

}

public override bool Filter(LogEntry entry) { ... }

}

but I now get the error msg "Constructor on type '...........CarbonLogFilter' not found". Any ideas I have tried adding a default (i.e. parameterless)constructor, but still get the same error msg.