我可以让RavenDB使用NLog WebService目标写入Seq吗?
我正在尝试将Ravendb3.0日志消息导入Seq Seq支持使用JSON发布原始事件: RavenDB使用NLog进行日志记录。NLog支持Web服务目标: 到目前为止,我的尝试是:我可以让RavenDB使用NLog WebService目标写入Seq吗?,ravendb,nlog,seq,Ravendb,Nlog,Seq,我正在尝试将Ravendb3.0日志消息导入Seq Seq支持使用JSON发布原始事件: RavenDB使用NLog进行日志记录。NLog支持Web服务目标: 到目前为止,我的尝试是: <target type='WebService' name='Seq' url='http://localhost:5341/api/events/raw' protocol='JsonPost' encoding='UTF-8'> <layo
<target type='WebService'
name='Seq'
url='http://localhost:5341/api/events/raw'
protocol='JsonPost'
encoding='UTF-8'>
<layout xsi:type="JsonLayout">
<attribute name='@t' layout="${longdate}" >
<attribute name='@mt' layout="${message}" >
</layout>
</target>
完整的NLog.config文件是:
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.netfx35.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target
xsi:type="AsyncWrapper"
name="AsyncLog">
<target xsi:type="SplitGroup">
<!-- create log files with a max size of 256 MB -->
<target
name="File"
xsi:type="File"
archiveAboveSize="268435456"
fileName="${basedir}\Logs\${shortdate}.log">
<layout xsi:type="CsvLayout">
<column name="time" layout="${longdate}" />
<column name="logger" layout="${logger}"/>
<column name="level" layout="${level}"/>
<column name="database" layout="${mdc:item=database}"/>
<column name="threadid" layout="${threadid}" />
<column name="message" layout="${message}" />
<column name="exception" layout="${exception:format=tostring}" />
</layout>
</target>
<target type='WebService'
name='Seq'
url='http://localhost:5341/api/events/raw'
protocol='JsonPost'
encoding='UTF-8'>
<layout xsi:type="JsonLayout">
<attribute name='@t' layout="${longdate}" >
<attribute name='@mt' layout="${message}" >
</layout>
</target>
</target>
</target>
<target
xsi:type="AsyncWrapper"
name="AsyncConflictLog">
<target xsi:type="SplitGroup">
<!-- create log files with a max size of 256 MB -->
<target
name="File"
xsi:type="File"
archiveAboveSize="268435456"
fileName="${basedir}\Logs\${shortdate}.conflicts.log">
<layout xsi:type="CsvLayout">
<column name="time" layout="${longdate}" />
<column name="logger" layout="${logger}"/>
<column name="level" layout="${level}"/>
<column name="database" layout="${mdc:item=database}"/>
<column name="threadid" layout="${threadid}" />
<column name="message" layout="${message}" />
<column name="exception" layout="${exception:format=tostring}" />
</layout>
</target>
</target>
</target>
</targets>
<rules>
<!--<logger name="Raven.Bundles.Replication.Plugins.*" writeTo="AsyncConflictLog" minlevel="Debug"/>-->
<logger name="Raven.*" writeTo="AsyncLog" minlevel="Trace"/>
</rules>
</nlog>
我觉得我的布局是无效的,但是我没有从RavenDB/NLog那里得到任何错误,所以很难找出它不喜欢的地方
有人这样做了吗,或者你能看到可能的错误吗?看起来RavenDB 3.0不可能这样做,因为它使用NLog 3.1,而JsonPost只是在NLog 4.4中添加的,我认为更新到NLog 4.4可能会起作用。检查您的内部日志以了解这些问题: