Specifying application name in log4net when using

2019-05-27 03:13发布

I have a couple of ASP.NET web applications I am testing and have set them up with Loggly using their appender for Log4net.

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.

1条回答
闹够了就滚
2楼-- · 2019-05-27 03:43

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)

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>
查看更多
登录 后发表回答