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: decide based on URL, client IP, ... doc
  • Sampled logging: random x% or throttled x per second.
  • Edit your config directly in the cloud drive. No restart required.
  • Control every namespace and type individually.

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)_.*")]
  • Target thousands of methods with a single line of code based on namespace, name, or visibility. doc
  • Create more complex filters with System.Reflection in C#. doc
  • Remove from release builds with #if DEBUG.

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.

Override anything

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

Custom Logging Framework – You can build an adapter for any VB/C# logging framework, including structured ones. doc example

Custom Transactions – If you like per-request logging but your app is not a web server, we have you covered. doc

Engineered for modern deployments

Distributed logging

If you're using a central logging server like Elasticsearch, correlating traces of a distributed app is a two-liner. doc example

Structured logging

When used with a modern framework such as Serilog, PostSharp Logging separates message templates from variable parameters, so you can easily search, filter and bucketize log records. doc

Insane performance

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 almost no performance impact at all. 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.

Privacy & security aware

Prevent passwords and confidential data to leak to logs thanks to the [NotLogged] attribute. doc

Fail safe

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

Subscribe to our newsletter

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.