Open sandboxFocus

Class PostSharpLoggingHttpModule

An IHttpModule that defines a PostSharp Logging activity (and possibly a transaction) for incoming HTTP requests. This module can be added as such to web.config. It can also be derived in a custom class, which allows you to override the LogEventMetadata. The default implementation is AspNetFrameworkRequestMetadata.

Inheritance
PostSharpLoggingHttpModule
Implements
Namespace: PostSharp.Patterns.Diagnostics.Adapters.AspNetFramework
Assembly: PostSharp.Patterns.Diagnostics.Adapters.AspNetFramework.dll
Syntax
public class PostSharpLoggingHttpModule : IHttpModule
Remarks

Register the module under system.webServer/modules in web.config. For distributed logging, set the CorrelationProtocol property when the application starts, for example in Global.asax, and accept correlation headers from trusted callers only. By default, RequestFilter excludes static content paths such as /css and /js.

Each captured request can open a logging transaction. A transaction policy of type AspNetFrameworkRequest in the logging configuration file can set the verbosity of selected requests, and its expressions see the request as an AspNetFrameworkRequestExpressionModel.

Constructors

Name Description
PostSharpLoggingHttpModule()

Initializes a new instance of the PostSharpLoggingHttpModule class with the default AspNetFrameworkRequestMetadata.

PostSharpLoggingHttpModule(LogEventMetadata, Predicate<Uri>, ICorrelationProtocol)

Initializes a new instance of the PostSharpLoggingHttpModule class and specifies a custom LogEventMetadata.

Properties

Name Description
CorrelationProtocol

Gets or sets the implementation of ICorrelationProtocol to support distributed logging and interpret incoming request headers.

RequestFilter

Gets or sets a predicate that determines whether a specific request should be logged. The default implementation filters out the following paths: /js, /css, /lib, /scripts, /content, /favicon.

See Also