问题描述
我有几个正在测试的ASP.NET Web应用程序,并已使用Loggnet的附加程序通过Loggly对其进行了设置.
I have a couple of ASP.NET web applications I am testing and have set them up with Loggly using their appender for Log4net.
现在,日志记录似乎很好,但是我似乎找不到找到一种方法(使用log4 loggly附加程序)来指定应用程序名称,这样当我在Loggly的仪表板上时,我可以将其过滤掉并仅查看日志特定的应用程序.
Now, logging seems to be fine but I can't seem to find a way (using log4 loggly appender) to specify an application name so that when I am at Loggly's dashboard I can filter them out and see only the logs of a particular application.
推荐答案
您不能使用HTTP/S事件端点(Loggly log4net附加程序在内部使用它)指定应用程序名称,此功能仅适用于syslog. (这是Loggly支持人员针对此问题的答案)
You can't specify an application name using HTTP/S Event Endpoint (Loggly log4net appender uses it inside), this feature is available only for syslog. (Here is the answer on this issue from Loggly support)
您应该使用标签将搜索范围限制为特定的相关日志组.您可以使用UserAgent属性在配置文件中指定标签:
You should use Tags to limit your searches to specific groups of related logs.You can specify tags in config file using UserAgent property:
<appender name="LogglyAppender" type="log4net.loggly.LogglyAppender, log4net-loggly">
<rootUrl value="https://logs-01.loggly.com/" />
<inputKey value="********-****-****-****-************" />
<userAgent value="TagOne,TagTwo,TagThree" />
</appender>
这篇关于使用Loggly时在log4net中指定应用程序名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!