Cannot find logs for .NET agent

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) 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.

<add key="ElasticApm:ServerUrls" value="http://apmserver:8200" />
<add key="ElasticApm:ServiceName" value="service-net-www7-test" />
<add key="ElasticApm:LogLevel" value="Debug" />


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

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 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.

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. :smiley:
Any other thoughts on how to test/debug the agent?

1 Like

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 applications. Users can use an utility such as 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 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?

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

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