Custom Event Listener

Topics: Semantic Logging Application Block
Jun 5, 2013 at 10:56 AM
Edited Jun 5, 2013 at 11:34 AM
Hi,

I have created a custom event listener, but am getting the following error when running SemanticLogging-svc.exe -c
"The event listener defintion with the name 'custom'was not found."
The SemanticLoggign-sv.xml has this in it
<eventSources>
    <eventSource name="MySource">
      <eventListeners>
        <eventListener name="custom" level="LogAlways"/>
      </eventListeners>
    </eventSource>    
   </eventSources>        
  <eventListeners>    
    <myEventListener xmlns="http://tempuri.org/SemanticLogging.xsd"
                           name="custom" 
                           host="10.1.19.197" 
                           port="3515"/>
  </eventListeners>
The MyEventListererElement is
[XmlRoot("myEventListener", Namespace = "http://tempuri.org/SemanticLogging.xsd")]
  public class MyEventListenerElement : EventListenerElement 
  {
    [XmlAttribute("host")]
    public string Host { get; set; }

    [XmlAttribute("port")]
    public int Port { get; set; }

    public override IEventListener CreateEventListener(Func<string, IEventTextFormatter> formatterFactory)
    {
      return new MyEventListener( this.Host, this.Port );
    }
  }
Then a MyEventListener with arb code in it
public class MyEventListener : IEventListener ...
I am sure it must be something simple I am missing ?

Thanks
-Steve
Jun 5, 2013 at 11:53 AM
Hi Steve,

Notice that the code you are using was from the CTP and not the final release. For details about writing custom listener (sinks) for out-of-process scenario you can find some good pointers in page 160 of Developer's Guide to Enterprise Library and in the Samples under the folder "SLABExtensibility".

Thanks,
Hernan
Jun 5, 2013 at 11:58 AM
Thanks, I will check that out.