views:

62

answers:

1

Problem is as follows:

On log event I want to send my custom object (lets say LogMessage that wraps in some way logging event) to my web service. Could work like appenders in log4net, or is there this kind of thing in Nlog btw? Or how do I do this NLog way?

Note: I'm using WebService target wrapper (if this helps in any way).

+1  A: 

[EDIT] I have added some links rather than simply telling you where to look.

NLog has a LogReceiverService and a LogReceiverServiceTarget (these might have been added for NLog 2.0 which just went to Beta recently). From what I can tell, one way to use the service is to use NLog for logging in your app. Configure to send all logging messages to LogReceiverTarget. Configure LogReceiverTarget to point to the LogReceiverService. LogReceiverTarget will create "NLogEvents" from log messages and forward them to the LogReceiverService. LogReceiverService will convert "NLogEvents" back to LogEvents and log them via NLog. In other words, you are logging via NLog in your app and LogReceiverService is also logging via NLog.

I am posting from iPhone so it is harder for me to add links to the relevant NLog topics. Go to NLog website and look for documentation on LogReceiverService. Also look in the forum. There has been some traffic recently on LogReceiverService. Finally, if you google "nlog git" you will find NLog's git source repository (for LogReceiverService specifically). You might be able to learn something there.

Good luck!

wageoghe