You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by ni...@apache.org on 2004/08/19 23:18:47 UTC

cvs commit: logging-log4net/src/Layout PatternLayout.cs

nicko       2004/08/19 14:18:47

  Modified:    src/Layout PatternLayout.cs
  Log:
  Cleaned up PatternLayout(string) constructor. Added more docs about ActivateOptions() method
  
  Revision  Changes    Path
  1.9       +16 -1     logging-log4net/src/Layout/PatternLayout.cs
  
  Index: PatternLayout.cs
  ===================================================================
  RCS file: /home/cvs/logging-log4net/src/Layout/PatternLayout.cs,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- PatternLayout.cs	30 Jul 2004 17:42:35 -0000	1.8
  +++ PatternLayout.cs	19 Aug 2004 21:18:47 -0000	1.9
  @@ -760,6 +760,11 @@
   		/// <see cref="CreatePatternParser"/>. If you override this method be
   		/// aware that it will be called before your is called constructor.
   		/// </para>
  +		/// <para>
  +		/// As per the <see cref="IOptionHandler"/> contract the <see cref="ActivateOptions"/>
  +		/// method must be called after the properties on this object have been
  +		/// configured.
  +		/// </para>
   		/// </remarks>
   		public PatternLayout() : this(DefaultConversionPattern)
   		{
  @@ -775,6 +780,10 @@
   		/// <see cref="CreatePatternParser"/>. If you override this method be
   		/// aware that it will be called before your is called constructor.
   		/// </para>
  +		/// <para>
  +		/// When using this constructor the <see cref="ActivateOptions"/> method 
  +		/// need not be called. This may not be the case when using a subclass.
  +		/// </para>
   		/// </remarks>
   		public PatternLayout(string pattern) 
   		{
  @@ -782,7 +791,13 @@
   			SetIgnoresException(true);
   
   			m_pattern = pattern;
  -			m_head = CreatePatternParser((pattern == null) ? DefaultConversionPattern : pattern).Parse();
  +
  +			if (m_pattern == null)
  +			{
  +				m_pattern = DefaultConversionPattern;
  +			}
  +
  +			m_head = CreatePatternParser(pattern).Parse();
   		}
   
   		#endregion