PostSharp
[Logging]
Add highly detailed logging to your .NET projects with zero impact on source code.
- Get highly detailed logs with method names and parameter values. Turn on/off for each web request.
- Zero impact on source code. Get started in minutes and keep business logic crystal clear.
- Completely customizable. Compatible with all logging frameworks.
High-Definition Logs: Under Control
All the Details You Need as a Developer
You can include the following pieces of data: Doc
- Method execution and field changes
- Parameter and return values
- Execution time
- Source code file name and line number
Enable on Demand, Without Restart
You never know what can happen in production. Build logging into your app, but enable it only when needed.
- Per-Request Logging: Make decisions based on URL, client IP, etc. doc
- Sampled Logging: Random x% or throttled x per second.
- Edit your configuration directly in the cloud drive. No restart is required.
- Control every namespace and type individually.
No Impact on Source Code
2
3
4
5
6
7
8
9
// 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
Integration with Any Logging Framework
PostSharp Logging integrates seamlessly with various .NET logging frameworks. If your preferred framework is not listed below, you can easily implement an adapter.
Override anything
Parameter Formatters – Customize how parameter values are rendered, even with external types. doc
Enable/Disable Features – Most features can be manually enabled or disabled, allowing you to use only the features you need. If you don't need parameter names, you can disable them. doc
Custom Logging Framework – You can build an adapter for any VB/C# logging framework, including structured ones. doc example
Custom Transactions – If you prefer per-request logging but your application is not a web server, We've got you covered. Documentation
Engineered for Modern Deployments
Distributed Logging
If you're using a central logging server like Elasticsearch, correlating traces of a distributed application is a simple two-line task. Documentation See an example
Structured Logging
When used with a modern framework such as Serilog, PostSharp Logging separates message templates from variable parameters, making it easy to search, filter, and bucketize log records. Documentation
Exceptional Performance
At PostSharp, we have an obsession with performance. PostSharp Logging outperforms hand-written code in most cases. When logging is disabled, the performance impact is almost negligible. Documentation
No Agent Required
PostSharp Logging instruments your code at build time, eliminating the need for any installations on end-user devices. It is compatible with desktop, mobile, and server devices.
No Monthly or Per-GB Costs
PostSharp Logging allows you to bring your own storage. Your data will be stored wherever you prefer.
Privacy & Security Awareness
The [NotLogged] attribute in PostSharp Logging helps prevent passwords and confidential data from leaking into logs. doc
Fail-Safe
We understand that things break. That's why we've implemented an aggressive circuit breaker in PostSharp Logging. This ensures that any failure in logging doesn't bring down your mission-critical operations. doc