PostSharp Diagnostics

Log your C# code without cluttering your codebase.

  • Add logging to thousands of methods within minutes.
  • Works with 10+ popular .NET logging frameworks.
  • Faster than hand-written code.
  • Measure execution time and get performance warnings.
  • Highly customizable.

Developer Edition


Stops logging after 24 hours.

Standard Edition

$595 for 5 users


Comprehensive logs for your C#/VB code

Performance First

Faster than hand-written code – Code instrumented with PostSharp is typically faster than code instrumented by hand. We've benchmarked.

Enable/disable at run time – Logging can be turned on and off dynamically at run time using a simple API. When logging is disabled, the cost overhead is as low as 0 thanks to the JIT compiler optimizations.

GC-friendly – PostSharp does not allocate memory unless your logging framework requires it. For instance, with ETW, striclty no managed memory is allocated.

No impact on source code

  • Target thousands of methods with a single line of code.
  • Filter based on the name or namespace using wildcards or regular expressions.
  • Filter based on the type or method visibility or another qualifier.
  • Create more complex filters with System.Reflection.
  • Remove from release builds with #if DEBUG.
// Log all public methods of the Contoso.BusinessLayer namespace.
[assembly: Log(AttributePriority = 1, 
               AttributeTargetTypes = "Contoso.BusinessLayer.*"
               AttributeTargetMemberAttributes = MulticastAttributes.Protected | 
                       MulticastAttributes.Internal | MulticastAttributes.Public)]
// Exclude property getters.
[assembly: Log(AttributePriority = 2, AttributeExclude = true, 
               AttributeTargetMembers = "get_*" )]

// In DEBUG build, add logging to the registry API.                    
[assembly: Log( AttributePriority = 3, AttributeTargetAssemblies = "mscorlib"
                AttributeTargetTypes = "Microsoft.Win32.Registry*" )]

Super Detailed

You can choose to include the following pieces of data into your logs:

  • Full method and type name
  • Parameter name, type and value
  • this value
  • Execution time
  • Async state machine id
  • Field changes
  • Source code file name and line number
  • Works on any method – not just public ones

Highly Customizable

Parameter Formatters – Customize how parameter values are rendered, even with external types.

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.

Override Anything – You can replace almost any formatting logic with your own.

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

Logging Frameworks

PostSharp provides out-of-the-box integration with the following .NET logging frameworks:

  • Log4Net
  • NLog
  • Common.Logging
  • Serilog
  • EventSource (ETW)
  • System.Diagnostics
  • Console.WriteLine
  • Microsoft.Extensions.Logging (.NET Core)
  • Enterprise Library
  • Application Insights
  • Loupe
  • Any other framework (custom back-end)
Break free from routine TODAY and start delivering more in less time.