Uploaded image for project: 'Log4net'
  1. Log4net
  2. LOG4NET-316

Provide a Layout Pattern that is re-evaluated on each use

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.2.11
    • 1.2.12
    • Other

    Description

      The DynamicPatternLayout is a layout pattern that is re-evaluated on each use. It is appropriate to use instead of LayoutPattern to provide dynamic strings in headers and footers for appenders. Datetime is an example. Using the standard layout pattern results in the same datetime in each header and footer, while using DynamicPatternLayout results in timestamp of the header/footer creation.

      Example
      <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>

      Attachments

        1. DynamicPatternLayout.cs
          5 kB
          Roy Chastain

        Issue Links

          Activity

            People

              nachbarslumpi Dominik Psenner
              roy@sohotech.biz Roy Chastain
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: