以下是我需要通过Log4net实现的目标。 我的应用程序具有第3方dll,该dll将日志同步地中继到Splunk RelayLogsToSplunk(Dictionary)。 该API接收字符串字典,并将其同步发送到splunk。 同步功能大大减慢了我的应用程序的速度。 我需要扩展Log ...
提示:本站收集StackOverFlow近2千万问答,支持中英文搜索,鼠标放在语句上弹窗显示对应的参考中文或英文, 本站还提供 中文繁体 英文版本 中英对照 版本,有任何建议请联系yoyou2525@163.com。
我有一个 .NET 框架 4.5.2 应用程序,它使用 Log4Net 进行日志记录。 我想使用 Azure Application Insights 作为界面来查看我所有应用程序部署的日志。 我安装了运行良好的 Microsoft.ApplicationInsights.Log4NetAppender。 但是,为了简化查询日志,我需要添加一个自定义属性。 我找不到任何关于如何使用 appender 设置的信息。 我发现唯一可行的解决方法是向项目添加带有自定义属性的遥测初始化程序。
问题是我不想通过遥测减慢应用程序的速度。 我只需要设置自定义属性并让我的 Log4net 只向 AppInsights 发送数据。 为此目的使用的最小设置是什么。 这是我得到的默认应用程序洞察配置 xml 文件。 如果我删除 Modules 标签内的所有内容,它就不能按我的意愿工作。
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
<TelemetryInitializers>
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.HttpDependenciesParsingTelemetryInitializer, Microsoft.AI.DependencyCollector"/>
</TelemetryInitializers>
<TelemetryModules>
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector">
<ExcludeComponentCorrelationHttpHeadersOnDomains>
<!--
Requests to the following hostnames will not be modified by adding correlation headers.
Add entries here to exclude additional hostnames.
NOTE: this configuration will be lost upon NuGet upgrade.
-->
<Add>core.windows.net</Add>
<Add>core.chinacloudapi.cn</Add>
<Add>core.cloudapi.de</Add>
<Add>core.usgovcloudapi.net</Add>
</ExcludeComponentCorrelationHttpHeadersOnDomains>
<IncludeDiagnosticSourceActivities>
<Add>Microsoft.Azure.EventHubs</Add>
<Add>Microsoft.Azure.ServiceBus</Add>
</IncludeDiagnosticSourceActivities>
</Add>
</TelemetryModules>
<ApplicationIdProvider Type="Microsoft.ApplicationInsights.Extensibility.Implementation.ApplicationId.ApplicationInsightsApplicationIdProvider, Microsoft.ApplicationInsights"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.