NLog. Message Values. Please, Help. It is urgent ... Thank You.

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

NLog. Message Values. Please, Help. It is urgent ... Thank You.

shapper
Hello,

I created a NLog logger as follows:

      NLog.Logger logger = NLog.LogManager.GetLogger("My Logger");

Where the follows works fine:

      NLog.LogEventInfo info = new NLog.LogEventInfo(NLog.LogLevel.Info, "My Logger", "My Message");
      info.Properties["data"] = "My Data";
      logger.Log(info);

When having the following in NLog.config: <parameter name="@Data" layout="${event-context:item=data}" />

But then I tried the following:

      logger.Info("My Message", new { data = "My Data" });

But I am not able to change my NLog.config to make this work.
How can I pass arguments this way?

Please, could someone help me?

Thank You,
Miguel
Loading...