C# Seq的app.config属性中的结构名称
我们正在应用程序中使用NLog 从本周开始,我们关注Seq(getseq.net),我们喜欢它。问题在于搜索很难,因为我们必须像C# Seq的app.config属性中的结构名称,c#,app-config,nlog,C#,App Config,Nlog,我们正在应用程序中使用NLog 从本周开始,我们关注Seq(getseq.net),我们喜欢它。问题在于搜索很难,因为我们必须像 @0=="someinfo" 所以我们看看Serilog,在这里我们可以有结构化的名称,比如 var data = new string.Format("Element name {name}", otherElement.name); 而不是 var data = new string.Format("Element name {0}", otherElemen
@0=="someinfo"
所以我们看看Serilog,在这里我们可以有结构化的名称,比如
var data = new string.Format("Element name {name}", otherElement.name);
而不是
var data = new string.Format("Element name {0}", otherElement.name);
我读了,看起来我们可以在Serilog中做一些事情,但我无法让它工作
App.config看起来像:
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<extensions>
<add assembly="Seq.Client.NLog" />
</extensions>
<targets>
<target name="seq" xsi:type="Seq" serverUrl="http://localhost:5341/">
<property name="MyValue" value="${event-context:item=MyValue}"/>
</target>
<rules>
<logger name="other" minlevel="Trace" writeTo="seq" />
</rules>
</nlog>
问题是属性“MyValue”从未在我的序列中设置
我看着它,但不能让它为我工作
谢谢能否在
NLog.config
文件中显示数据库目标的完整配置?你不应该用
标签而不是
标签吗?只要更新App.config部分,我不使用NLog.config。但我们得到了Serilog的回复,这不是同一个问题,但我们从Serilog和seq那里得到了我们想要的东西,这是NLog无法做到的
LogEventInfo theEvent = new LogEventInfo(NLog.LogLevel.Debug, "", "Pass my custom value");
theEvent.Properties["MyValue"] = "My custom string";
_myLog.Debug(theEvent);