DynamicPatternLayout ClassApache log4net™ SDK Documentation
A flexible layout configurable with pattern string that re-evaluates on each call.
Inheritance Hierarchy


Namespace: log4net.Layout
Assembly: log4net (in log4net.dll) Version: 4.0

public class DynamicPatternLayout : PatternLayout

The DynamicPatternLayout type exposes the following members.


Public methodDynamicPatternLayout
Constructs a DynamicPatternLayout using the DefaultConversionPattern
Public methodDynamicPatternLayout(String)
Constructs a DynamicPatternLayout using the supplied conversion pattern

Public propertyContentType
The content type output by this layout.
(Inherited from LayoutSkeleton.)
Public propertyConversionPattern
The pattern formatting string
(Inherited from PatternLayout.)
Public propertyFooter
The footer for the layout format.
(Overrides LayoutSkeletonFooter.)
Public propertyHeader
The header for the layout format.
(Overrides LayoutSkeletonHeader.)
Public propertyIgnoresException
Flag indicating if this layout handles exceptions
(Inherited from LayoutSkeleton.)

Public methodActivateOptions
Initialize layout options
(Inherited from PatternLayout.)
Public methodAddConverter(ConverterInfo)
Add a converter to this PatternLayout
(Inherited from PatternLayout.)
Public methodAddConverter(String, Type)
Add a converter to this PatternLayout
(Inherited from PatternLayout.)
Protected methodCreatePatternParser
Create the pattern parser instance
(Inherited from PatternLayout.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFormat(LoggingEvent)
Convenience method for easily formatting the logging event into a string variable.
(Inherited from LayoutSkeleton.)
Public methodFormat(TextWriter, LoggingEvent)
Produces a formatted string as specified by the conversion pattern.
(Inherited from PatternLayout.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)

This class is built on PatternLayout and provides all the features and capabilities of PatternLayout. PatternLayout is a 'static' class in that its layout is done once at configuration time. This class will recreate the layout on each reference.

One important difference between PatternLayout and DynamicPatternLayout is the treatment of the Header and Footer parameters in the configuration. The Header and Footer parameters for DynamicPatternLayout must be syntactically in the form of a PatternString, but should not be marked as type log4net.Util.PatternString. Doing so causes the pattern to be statically converted at configuration time and causes DynamicPatternLayout to perform the same as PatternLayout.

Please see PatternLayout for complete documentation.


<layout type="log4net.Layout.DynamicPatternLayout"> <param name="Header" value="%newline**** Trace Opened Local: %date{yyyy-MM-dd HH:mm:ss.fff} UTC: %utcdate{yyyy-MM-dd HH:mm:ss.fff} ****%newline" /> <param name="Footer" value="**** Trace Closed %date{yyyy-MM-dd HH:mm:ss.fff} ****%newline" /> </layout>
See Also