Serilog - 应用程序名称的AppSettings

时间:2018-01-16 11:35:36

标签: .net appsettings serilog

我正在尝试从App.Config中读取应用程序名称。这是public static void main (String args[]) throws ParseException { Double value = 12803.000000; SimpleDateFormat format = new SimpleDateFormat("HHmmss"); String intValueStr = String.valueOf(value.intValue() ); int length = intValueStr.length(); int missingDigits = 6- length; String strForTimeParsing = intValueStr; for(int i =0; i< missingDigits;i++){ strForTimeParsing = "0"+strForTimeParsing; } System.out.println("Final String after padding Zeros at the start = "+strForTimeParsing); Date parsedDate = format.parse(strForTimeParsing); String format1 = new SimpleDateFormat("HH:mm:ss").format(parsedDate); System.out.println("Resulted Formatted Time = "+format1); } 控制台应用。我添加了Serilog.Settings.AppSettings包。并在App.Config上添加了以下serilog配置

net461

但是Seq上没有显示应用程序名称。但是,我在<add key="serilog:properties:Application" value="My App"/> <add key="serilog:minimum-level" value="Debug" /> <add key="serilog:minimum-level:override:Microsoft" value="Debug" /> <add key="serilog:enrich:FromLogContext"/> <add key="serilog:enrich:WithMachineName"/> <add key="serilog:enrich:WithProcessId"/> <add key="serilog:using:Seq" value="Serilog.Sinks.Seq"/> <add key="serilog:write-to:Seq.serverUrl" value="http://localhost:5341" /> <add key="serilog:using:Console" value="Serilog.Sinks.Console" /> <add key="serilog:write-to:Console"/> 上为.netcore2项目添加了以下设置,这可以按预期工作

appsettings.json

缺少什么?

1 个答案:

答案 0 :(得分:4)

我相信你需要:

$('#lightSlider').find(".active").find("img").attr("src");

(而不是<add key="serilog:enrich:with-property:Application" value="My App" />