Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default TraceListener based logger for ASP.NET Full Framework #1263

Closed
russcam opened this issue Apr 14, 2021 · 0 comments · Fixed by #1288
Closed

Default TraceListener based logger for ASP.NET Full Framework #1263

russcam opened this issue Apr 14, 2021 · 0 comments · Fixed by #1288
Assignees
Labels
agent-dotnet enhancement New feature or request

Comments

@russcam
Copy link
Contributor

russcam commented Apr 14, 2021

A hook is provided in the ASP.NET Full Framework HTTP module to allow users to implement an IApmLogger to integrate with their own logging framework. When no logger implementation is provided, the integration uses a ConsoleLogger to write APM agent logs which writes to Console.Out. For an ASP.NET application running in IIS, Console.Out is a null stream, such that logs are not captured.

A default IApmLogger for ASP.NET Full Framework that uses System.Diagnostics.Trace would allow a user to configure a TraceListener in web.config to capture APM agent logs, without needing to implement an IApmLogger; a user may still want to implement an IApmLogger for better integration with their logging framework of choice, but the default logger implementation would at least allow capturing of agent logs, with some configuration file changes.

System.Diagnostics.Trace is dependent on the TRACE compiler constant, which is specified by default for both Debug and Release build configurations.

@russcam russcam added the enhancement New feature or request label Apr 14, 2021
@russcam russcam self-assigned this Apr 28, 2021
russcam added a commit to russcam/apm-agent-dotnet that referenced this issue May 4, 2021
This commit adds a logger implementation, TraceLogger, that
writes agent logs to a TraceSource with name "Elastic.Apm".
This logger is configured as the default logger for
ASP.NET Full Framework applications, which can use configuration
to write log messages to file, debug window, Windows event log, etc.

Add a section to docs with an example of how to configure
the logger in web.config.

Move the default log level from ConsoleLogger into DefaultValues.

Closes elastic#1263
russcam added a commit that referenced this issue May 27, 2021
This commit adds a logger implementation, TraceLogger, that
writes agent logs to a TraceSource with name "Elastic.Apm".
This logger is configured as the default logger for
ASP.NET Full Framework applications, which can use configuration
to write log messages to file, debug window, Windows event log, etc.

Add a section to docs with an example of how to configure
the logger in web.config.

Move the default log level from ConsoleLogger into DefaultValues.

Closes #1263
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-dotnet enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant