Dotnet 核心、JSNLog 和 Serilog 之间的不兼容
Incompatibility between Dotnet core, JSNLog and Serilog
我尝试在结构化模式下将 JSNLog 与 Serilog 一起使用,如文档中所述:
http://jsnlog.com/Documentation/HowTo/StructuredLogging
我在 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
在我的 project.json 中,我有以下配置:
"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"
当我尝试添加
"JSNLog.Serilog": project.json 文件中的“2.20.1”,我在编译时收到以下错误:
The type or namespace name 'LoggingAdapter' could not be found (are
you missing a using directive or an assembly reference?)
有什么想法吗?
最新版本的 JSNLog 现在可以很好地与 .Net Core 配合使用。看一下:
http://jsnlog.com/Documentation/DownloadInstall/ForAspNetCore
https://github.com/mperdeck/jsnlog.AspNet5Demo
我是JSNLog的作者
我尝试在结构化模式下将 JSNLog 与 Serilog 一起使用,如文档中所述: http://jsnlog.com/Documentation/HowTo/StructuredLogging
我在 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
在我的 project.json 中,我有以下配置:
"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"
当我尝试添加 "JSNLog.Serilog": project.json 文件中的“2.20.1”,我在编译时收到以下错误:
The type or namespace name 'LoggingAdapter' could not be found (are you missing a using directive or an assembly reference?)
有什么想法吗?
最新版本的 JSNLog 现在可以很好地与 .Net Core 配合使用。看一下: http://jsnlog.com/Documentation/DownloadInstall/ForAspNetCore https://github.com/mperdeck/jsnlog.AspNet5Demo
我是JSNLog的作者