configuring an nlog sink

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

configuring an nlog sink

f00f
Hi,

I must be doing something wrong, but for the life of me, I can't figure out what.  I want to create a log sink for all of my different processes, but I'm having trouble sending over LogEventInfo.Properties.  On the log sink side, all I ever get is the default stuff (the message, logger name, timestamp, etc).

This is the class I'm using to check that events are making it over.  I have a break point in the ProcessLogMessages() function.

public class LogReceiver : LogReceiverForwardingService {
        protected override void ProcessLogMessages(LogEventInfo[] logEvents)
        {
            base.ProcessLogMessages(logEvents);
        }
}

Here's where things get wonky:  If I turn on includeEventProperties="true" in the target, it will simply fail to connect.  I never hit my breakpoint.  So, what if I turn my custom properties?
      <target xsi:type="LogReceiverService" name="webService"  endpointAddress="http://localhost:5000/LogReceiver.svc">
             <parameter name="shortAssembly" layout="${event-context:item=shortAssembly}"  />
      </target>
That fails in a different way: I get a property named "shortAssembly" on the other side, but instead of being a string, it is a char.  It isn't even the first char that I pass over... My next guess was that parameter was guessing the wrong type, so I changed it to:
             <parameter name="shortAssembly" layout="${event-context:item=shortAssembly}" type="String" />
but again, no dice.  

There must be something very obvious and very easy that I'm doing wrong here.  Help!

Thanks,
alex.