LogReceiverService

Jun 30, 2011 at 12:04 PM

im just trying to call wcf service using silverlight by LogReceiverService(NLog).

my silverlight codeing: MainPage.xaml.cs

using NLog;

private void Button_click(object sender, RoutedEventArgs)

{

Logger log = LogManager.GetLogger("LoggerName");

log.Debug("hi");



}

Nlog.config file:

 <targets>
    <target name="WcfServiceTargets" xsi:type="LogReceiverService"  endpointAddress="http://localhost:2645/Service1.svc">
      <parameter name="GetData" layout="${threadid}" />
      <parameter name="message" layout="${message}" />
    </target>
  </targets>

  <rules>
    <logger name="*" minlevel="Debug" writeTo="WcfServiceTargets" />
  </rules>

WCF service Coding:

using NLog.LogReceiverService;


namespace WcfServiceTargets
{
   
    public class Service1 : ILogReceiverServer
    {


        public void ProcessLogMessages(NLogEvents nevents)
        {
            var events = nevents.ToEventInfo("Client.");
            //Console.WriteLine("in: {0} {1}", nevents.Events.Length, events.Count);

            foreach (var ev in events)
            {
                var logger = LogManager.GetLogger(ev.LoggerName);
                logger.Log(ev);
            }
        }
       }

NLog.config file in WCF:

 <targets>      
 <target name="file" xsi:type="File"
            layout="${longdate} ${logger} ${event-context:ClientName} ${event-context:message}"
            fileName="$E:/logs/logfile.txt"
            keepFileOpen="false"
            encoding="iso-8859-2" />

    </targets>

i cant able to invoke WCF service. can anyone help me to fix my problem