I try to use JSNLog in structured mode with Serilog as explained in the documentation: http://jsnlog.com/Documentation/HowTo/StructuredLogging
I have the following code in the startup.cs
var jsnlogConfiguration = new JsnlogConfiguration
{
serverSideMessageFormat = "[UserIp: %userHostAddress], [Url: %url], [Browser: %userAgent] %message"
};
app.UseApplicationInsightsRequestTelemetry()
.UseApplicationInsightsExceptionTelemetry()
.UseStaticFiles()
.UseMvc(routes => { routes.MapRoute("default", "{controller=Home}/{action=Index}/{id?}"); })
.UseJSNLog(new LoggingAdapter(loggerFactory), jsnlogConfiguration); // Javascript logging
And in my project.json, I have the following configuration:
"JSNLog.AspNetCore": "2.20.1",
"Serilog": "2.3.0",
"Serilog.Extensions.Logging": "1.2.0",
"Serilog.Sinks.File": "3.1.0",
"Serilog.Sinks.RollingFile": "3.1.0",
"Serilog.Sinks.Literate": "2.0.0",
"Serilog.Sinks.AzureTableStorage": "2.0.0",
"Serilog.Settings.Configuration": "2.1.0",
"Serilog.Enrichers.Environment": "2.1.0",
"Serilog.Enrichers.Thread": "2.0.0"
When I try to add "JSNLog.Serilog": "2.20.1" in the project.json file, I receive the following errors at compile time:
The type or namespace name 'LoggingAdapter' could not be found (are you missing a using directive or an assembly reference?)
Any idea?
The latest versions of JSNLog now work well with .Net Core. Have a look at: http://jsnlog.com/Documentation/DownloadInstall/ForAspNetCore https://github.com/mperdeck/jsnlog.AspNet5Demo
I am the author of JSNLog.