PostSharp 6.9 / / Post­Sharp Documentation / Logging

Logging

PostSharp Logging allows you to add logging to your complete solution in just a few lines of code.

It has the following benefits:

  • Can produce super-detailed logs including parameter values and execution time.

  • Can stay turned off by default and be dynamically enabled on-demand, with fine-grained control over types and namespaces, when a problem happens in production. This can be done just by editing a configuration file in an online file hosting service such as Google Drive.

  • Super fast. In fact, often faster than string.Format.

  • Fully customizable. Works with your logging framework (even your custom one)

  • Supports a broad set of logging frameworks.

  • Supports structured log servers (such as Elastic Search or Application Insights) and statistical processing of messages.

  • Supports distributed systems and helps generating correlation info.

In this chapter

Section

Description

Getting Started with PostSharp Logging

This article shows how to add detailed logging to your application.

Connecting to Source and Target Logging Frameworks

This article shows how to connect PostSharp Logging to supported logging frameworks.

Formatting Log Records

This article describes how to customize the log records. It covers both build-time configuration (logging profiles) and run-time configuration.

Adding Manual Logging

This article explains how to add manual log records and custom activities to your log.

Adjusting Logging Verbosity

This article shows how to enable and disable logging for a specific type and namespace, and message severity.

Logging in a Distributed System

This article explains how to configure PostSharp Logging to make sure that the produced logs are useful and meaningful in a distributed system.

Implementing a Custom Formatter

This article shows how to create your own formatter to display the value of parameter values.

Building Your Own Logging Backend (Adapter)

This article demonstrates how to use your own logging framework with PostSharp Logging.

Handling Logging Exceptions

This article explains what happens when the logging component fails and how to customize this behavior.

See Also