locked
Enterprise Library, Logging Application Block, Custom Filter RRS feed

  • Question

  • 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?

     

    Wednesday, November 29, 2006 3:36 PM

Answers

  • Namespace: Microsoft.Practices.EnterpriseLibrary.Common.Configuration  
      
    Assembly: Microsoft.Practices.EnterpriseLibrary.Common (in microsoft.practices.enterpriselibrary.common.dll) 
    Wednesday, November 29, 2006 4:53 PM

All replies

  • Namespace: Microsoft.Practices.EnterpriseLibrary.Common.Configuration  
      
    Assembly: Microsoft.Practices.EnterpriseLibrary.Common (in microsoft.practices.enterpriselibrary.common.dll) 
    Wednesday, November 29, 2006 4:53 PM
  • 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.

    Thursday, November 30, 2006 3:38 PM