No EventLog for Aspnet Core with Nlog

 If you trying to pass a json object you can still do so just not with the EventLog object. Instead just use the MS LogIformation method with the object as your parameters. I still havent got it to format the json object in the logs but for now this is a solution.

Another solution is to pull the nlog object in and not use the MS LogInformation in

Logger log = LogManager.GetCurrentClassLogger();

 I haven't done this yet but I dont see a logical issue just bad design 

More Improvements: https://blog.elmah.io/nlog-tutorial-the-essential-guide-for-logging-from-csharp/

Global Diagnostics Context

This context is implemented in the GlobalDiagnosticsContext class and represents a dictionary spanning the entire lifetime of your application. This context is great for including global properties to all log messages. A global property could be the name of the application, the version number, or other common information that you want access to on all log messages.

Adding properties to the global context can be done in your startup/initialization code like this:

GlobalDiagnosticsContext.Set("Application", "My cool app");
GlobalDiagnosticsContext.Set("Version", "1.0.42");

Popular posts from this blog

Aspetcore: NLog with Postgresql

Mongodb Cheatsheet

Installing Windows on Acer chromebook 15 cb3-532