Add highly detailed logging to your .NET projects with zero impact on source code.
- Get highly detailed logs with method names, parameters, return values, and execution time.
- Zero impact on source code. Get started in minutes and keep business logic crystal clear.
- Completely customizable. Compatible with all logging frameworks.
The highest level of details
You can choose to include the following pieces of data into your logs: doc
- Method execution and field changes
- Parameter and return values
- Execution time
- Source code file name and line number
- Awaited method
Works on any method
Unlike other technologies, PostSharp Logging lets you instrument all methods, including private or static ones. It can also log changes to fields.
No impact on source code
// Log all public methods of Contoso.BusinessLayer. [assembly: Log(AttributePriority = 1, AttributeTargetTypes = "Contoso.BusinessLayer.*, AttributeTargetMemberAttributes = MulticastAttributes.Public)] // Exclude property getters and setters. [assembly: Log(AttributePriority = 2, AttributeTargetMembers = "regex:(get|set)_.*")]
Customizable to your needs
Any logging framework
PostSharp Logging provides out-of-the-box integration with the following .NET logging frameworks. If yours is not listed, it's easy to implement an adapter.
Parameter Formatters – Customize how parameter values are rendered, even with external types. doc
Enable/Disable Features – Most features can be enabled or disabled manually so you only get what you actually need. Don't need parameter names? No problem. doc
Engineered to the demands of modern deployments
We at PostSharp have an obsession for performance. PostSharp Logging is faster than hand-written code in most cases. When logging is disabled, there is no performance impact at all. doc
Things break. You know. But we don't want your mission-critical to go down just because logging does not work. We've implemented an aggressive circuit breaker so that when any failure happens, logging is immediately disabled. doc
Privacy & security aware
Prevent passwords and confidential data to leak to logs thanks to the [NotLogged] attribute. doc
When using a semantic logging framework and log server such as Serilog with ElasticSearch, PostSharp Logging separates message templates from variable parameters, so you can easily search, filter and bucketize log records. doc
PostSharp Logging supports the key concepts of distributed logging: activities (also named scopes or traces), baggage, and synthetic ids. doc
Instead of generating tens of GBs by logging all requests, you can choose to capture only a random sample of them. doc
No agent needed
PostSharp Logging instruments your code at build time. You don't need to install anything on end-user devices. It works on desktop, mobile and server devices.
No monthly or per-GB costs
Bring your own storage. PostSharp Logging will store your data where you want.