# Cannot find logs for .NET agent

**URL:** <https://discuss.elastic.co/t/cannot-find-logs-for-net-agent/211350>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [December 10, 2019, 6:02pm UTC](https://discuss.elastic.co/t/cannot-find-logs-for-net-agent/211350 "2019-12-10T18:02:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![JValenzani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jvalenzani/32/59147_2.png) [@JValenzani](https://discuss.elastic.co/u/JValenzani)\
**Post date:** [December 10, 2019, 6:02pm UTC](https://discuss.elastic.co/t/cannot-find-logs-for-net-agent/211350/1 "2019-12-10T18:02:33Z")

</div>

I've configured the APM agent to monitor a running application on IIS 7. I can't see the service in the APM server, so i thinks there's a problem somewhere. Looking around the forum i found this answer ([After updating Apm Agent from 1.1.2 to 1.2 transactions are empty](https://discuss.elastic.co/t/after-updating-apm-agent-from-1-1-2-to-1-2-transactions-are-empty/211081/6)) saying that APM client logs to stdout. I'm not an expert in windows administration, but did some research and found that in IIS this means writing to Stream.null (something like /dev/null for we, linux people).

So, the question is, how to know what's happening if i cannot see the logs? Is there other way i can see what's happening? I'm not getting any kind of error in the Event Viewer.

Web.config:  
\<add key="ElasticApm:ServerUrls" value="[http://apmserver:8200](http://apmserver:8200)" /\>  
\<add key="ElasticApm:ServiceName" value="service-net-www7-test" /\>  
\<add key="ElasticApm:LogLevel" value="Debug" /\>

Thanks.

**Kibana version** : 7.4  
**Elasticsearch version** : 7.4  
**APM Server version** : 7.4  
**APM Agent language and version** : .NET Elastic.Apm.AspNetFullFramework 1.2.0  
**Original install method (e.g. download page, yum, deb, from source, etc.) and version** : NuGet

---

<div class="post-metadata">

**Author:** ![Sergey\_Kleyman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergey_kleyman/32/39333_2.png) [@Sergey\_Kleyman](https://discuss.elastic.co/u/Sergey_Kleyman)\
**Post date:** [December 10, 2019, 6:20pm UTC](https://discuss.elastic.co/t/cannot-find-logs-for-net-agent/211350/2 "2019-12-10T18:20:19Z")

</div>

We need some improvement in Agent's logging area - at the moment I see two options:

1. Redirect standard output to a file using [`Console.SetOut`](https://docs.microsoft.com/en-us/dotnet/api/system.console.setout?view=netframework-4.8#remarks) API.
2. A better solution would be to have Agent log via the logging framework you use for the rest of the application. Agent supports logger as a dependency. You can see an example for using NLog [here](https://github.com/elastic/apm-agent-dotnet/blob/master/sample/AspNetFullFrameworkSampleApp/App_Start/LoggingConfig.cs#L56).

---

<div class="post-metadata">

**Author:** ![JValenzani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jvalenzani/32/59147_2.png) [@JValenzani](https://discuss.elastic.co/u/JValenzani)\
**Post date:** [December 10, 2019, 6:50pm UTC](https://discuss.elastic.co/t/cannot-find-logs-for-net-agent/211350/3 "2019-12-10T18:50:15Z")

</div>

Hi @Sergey_Kleyman, thanks for your answer. I don't have access to the source code. I need something that i can configure from the IIS or application web.config. The application seems to be using log4net, that's all i know. 😃  
Any other thoughts on how to test/debug the agent?

---

<div class="post-metadata">

**Author:** ![Sergey\_Kleyman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergey_kleyman/32/39333_2.png) [@Sergey\_Kleyman](https://discuss.elastic.co/u/Sergey_Kleyman)\
**Post date:** [December 12, 2019, 9:17am UTC](https://discuss.elastic.co/t/cannot-find-logs-for-net-agent/211350/4 "2019-12-12T09:17:41Z")

</div>

Hi @JValenzani

As I mentioned above long term we need some improvement in Agent's logging area.  
Short term one possible solution might be to change the default sink for Agent's logger to `System.Diagnostics.Trace` instead of `Console` for [ASP.NET/IIS](http://asp.net/IIS) applications. Users can use an utility such as [DebugView](https://docs.microsoft.com/en-us/sysinternals/downloads/debugview) to view the logs. It's a GUI utility so probably it will not work on a headless Windows and it will require remote desktop into the server. It might be possible to [redirect `System.Diagnostics.Trace` to a file using just the configuration](https://docs.microsoft.com/en-us/dotnet/framework/debug-trace-profile/how-to-create-and-initialize-trace-listeners#to-create-and-use-a-trace-listener-by-using-a-configuration-file) but I didn't try redirecting `System.Diagnostics.Trace` to a file before so that is not 100%. Can you use DebugView in your environment?

---

<div class="post-metadata">

**Author:** ![JValenzani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jvalenzani/32/59147_2.png) [@JValenzani](https://discuss.elastic.co/u/JValenzani)\
**Post date:** [December 12, 2019, 4:05pm UTC](https://discuss.elastic.co/t/cannot-find-logs-for-net-agent/211350/5 "2019-12-12T16:05:47Z")

</div>

Yes. I have access to the server and can install DebugView.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 2, 2020, 12:05pm UTC](https://discuss.elastic.co/t/cannot-find-logs-for-net-agent/211350/6 "2020-01-02T12:05:47Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
