Possible new code - DynamicPatternLayout

2011-09-12 Thread Roy Chastain
I have a new class that I implemented several years ago.  It provides a
DynamicPatternConverter.  Its primary purpose is to provide dynamic
headers and footers in logs.

Below is the description from the code
/// summary
/// A flexible layout configurable with pattern string that
re-evaluates on each call.
/// /summary
/// remarks
/// paraThis class is built on see
cref=PatternLayout/see 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./para
/// paraOne 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 staticly converted at configuration tiame and
causes DynamicPatternLayout
/// to perform the same as PatternLayout./para
/// paraPlease see see cref=PatternLayout/ for complete
documentation./para
/// example
/// lt;layout
type=log4net.Layout.DynamicPatternLayoutgt;
///   lt;param name=Header value=%newline Trace Opened
Local: %date{-MM-dd HH:mm:ss.fff} UTC: %utcdate{-MM-dd
HH:mm:ss.fff} %newline /gt;
///   lt;param name=Footer value= Trace Closed
%date{-MM-dd HH:mm:ss.fff} %newline /gt;
/// lt;/layoutgt;
/// /example
/// /remarks

I do not have test cases.  This code is available for inclusion in
log4Net if anyone feels that it is worth including.  I like it because I
can scan through a logfile and find out when it was closed and/or
opened.  (Append = true).  The entire module is 142 lines including
comments.

--
Roy Chastain






Re: Possible new code - DynamicPatternLayout

2011-09-12 Thread Stefan Bodewig
On 2011-09-12, Roy Chastain wrote:

 I have a new class that I implemented several years ago.  It provides a
 DynamicPatternConverter.  Its primary purpose is to provide dynamic
 headers and footers in logs.

Aren't you paying a big price for this by also making the normal
pattern dynamic?  Maybe there is room for something in between where
only Header and Footer are dynamic?

 I do not have test cases.

But could add some ;-)

 This code is available for inclusion in log4Net if anyone feels that
 it is worth including.

I think it is (post 1.2.11).

Stefan


RE: Possible new code - DynamicPatternLayout

2011-09-12 Thread Roy Chastain
No price.  Only the header and footer as surfaced in the new class, so
the other properties resort back to their normal processing.  In
reality, the ConversionPattern for the log output is already dynamic,
but header and footer were not treated the same.

Ron G. actually gave me the idea of how to do this.

Do I run a diff against an empty file to produce the patch or is there
another method?

--
Roy Chastain




-Original Message-
From: Stefan Bodewig [mailto:bode...@apache.org] 
Sent: Monday, September 12, 2011 11:48
To: log4net-dev@logging.apache.org
Subject: Re: Possible new code - DynamicPatternLayout

On 2011-09-12, Roy Chastain wrote:

 I have a new class that I implemented several years ago.  It provides 
 a DynamicPatternConverter.  Its primary purpose is to provide dynamic 
 headers and footers in logs.

Aren't you paying a big price for this by also making the normal
pattern dynamic?  Maybe there is room for something in between where
only Header and Footer are dynamic?

 I do not have test cases.

But could add some ;-)

 This code is available for inclusion in log4Net if anyone feels that 
 it is worth including.

I think it is (post 1.2.11).

Stefan