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 bo...@apache.org on 2011/08/17 07:57:04 UTC
svn commit: r1158529 [3/7] - in /logging/log4net/trunk: ./ doc/css/
examples/ examples/mono/ examples/mono/1.0/ examples/mono/1.0/Performance/
examples/mono/1.0/Performance/NotLogging/
examples/mono/1.0/Performance/NotLogging/cs/ examples/mono/1.0/Perf...
Modified: logging/log4net/trunk/src/Layout/Pattern/StackTracePatternConverter.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Layout/Pattern/StackTracePatternConverter.cs?rev=1158529&r1=1158528&r2=1158529&view=diff
==============================================================================
--- logging/log4net/trunk/src/Layout/Pattern/StackTracePatternConverter.cs (original)
+++ logging/log4net/trunk/src/Layout/Pattern/StackTracePatternConverter.cs Wed Aug 17 05:57:00 2011
@@ -1,149 +1,149 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-#endregion
-
-using System;
-using System.IO;
-using System.Diagnostics;
-
-using log4net.Util;
-using log4net.Core;
-
-namespace log4net.Layout.Pattern
-{
- /// <summary>
- /// Write the caller stack frames to the output
- /// </summary>
- /// <remarks>
- /// <para>
- /// Writes the <see cref="LocationInfo.StackFrames"/> to the output writer, using format:
- /// type3.MethodCall3 > type2.MethodCall2 > type1.MethodCall1
- /// </para>
- /// </remarks>
- /// <author>Michael Cromwell</author>
- internal class StackTracePatternConverter : PatternLayoutConverter, IOptionHandler
- {
- private int m_stackFrameLevel = 1;
-
- /// <summary>
- /// Initialize the converter
- /// </summary>
- /// <remarks>
- /// <para>
- /// This is part of the <see cref="IOptionHandler"/> delayed object
- /// activation scheme. The <see cref="ActivateOptions"/> method must
- /// be called on this object after the configuration properties have
- /// been set. Until <see cref="ActivateOptions"/> is called this
- /// object is in an undefined state and must not be used.
- /// </para>
- /// <para>
- /// If any of the configuration properties are modified then
- /// <see cref="ActivateOptions"/> must be called again.
- /// </para>
- /// </remarks>
- public void ActivateOptions()
- {
- if (Option == null)
- return;
-
- string optStr = Option.Trim();
- if (optStr.Length != 0)
- {
- int stackLevelVal;
- if (SystemInfo.TryParse(optStr, out stackLevelVal))
- {
- if (stackLevelVal <= 0)
- {
- LogLog.Error(declaringType, "StackTracePatternConverter: StackeFrameLevel option (" + optStr + ") isn't a positive integer.");
- }
- else
- {
- m_stackFrameLevel = stackLevelVal;
- }
- }
- else
- {
- LogLog.Error(declaringType, "StackTracePatternConverter: StackFrameLevel option \"" + optStr + "\" not a decimal integer.");
- }
- }
- }
-
- /// <summary>
- /// Write the strack frames to the output
- /// </summary>
- /// <param name="writer"><see cref="TextWriter" /> that will receive the formatted result.</param>
- /// <param name="loggingEvent">the event being logged</param>
- /// <remarks>
- /// <para>
- /// Writes the <see cref="LocationInfo.StackFrames"/> to the output writer.
- /// </para>
- /// </remarks>
- override protected void Convert(TextWriter writer, LoggingEvent loggingEvent)
- {
- StackFrame[] stackframes = loggingEvent.LocationInformation.StackFrames;
- if ((stackframes == null) || (stackframes.Length <= 0))
- {
- LogLog.Error(declaringType, "loggingEvent.LocationInformation.StackFrames was null or empty.");
- return;
- }
-
- int stackFrameIndex = m_stackFrameLevel - 1;
- while (stackFrameIndex >= 0)
- {
- if (stackFrameIndex > stackframes.Length)
- {
- stackFrameIndex--;
- continue;
- }
-
- StackFrame stackFrame = stackframes[stackFrameIndex];
- writer.Write("{0}.{1}", stackFrame.GetMethod().DeclaringType.Name, GetMethodInformation(stackFrame.GetMethod()));
- if (stackFrameIndex > 0)
- {
- // TODO: make this user settable?
- writer.Write(" > ");
- }
- stackFrameIndex--;
- }
- }
-
- /// <summary>
- /// Returns the Name of the method
- /// </summary>
- /// <param name="method"></param>
- /// <remarks>This method was created, so this class could be used as a base class for StackTraceDetailPatternConverter</remarks>
- /// <returns>string</returns>
- internal virtual string GetMethodInformation(System.Reflection.MethodBase method)
- {
- return method.Name;
- }
-
- #region Private Static Fields
-
- /// <summary>
- /// The fully qualified type of the StackTracePatternConverter class.
- /// </summary>
- /// <remarks>
- /// Used by the internal logger to record the Type of the
- /// log message.
- /// </remarks>
- private readonly static Type declaringType = typeof(StackTracePatternConverter);
-
- #endregion Private Static Fields
- }
-}
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion
+
+using System;
+using System.IO;
+using System.Diagnostics;
+
+using log4net.Util;
+using log4net.Core;
+
+namespace log4net.Layout.Pattern
+{
+ /// <summary>
+ /// Write the caller stack frames to the output
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Writes the <see cref="LocationInfo.StackFrames"/> to the output writer, using format:
+ /// type3.MethodCall3 > type2.MethodCall2 > type1.MethodCall1
+ /// </para>
+ /// </remarks>
+ /// <author>Michael Cromwell</author>
+ internal class StackTracePatternConverter : PatternLayoutConverter, IOptionHandler
+ {
+ private int m_stackFrameLevel = 1;
+
+ /// <summary>
+ /// Initialize the converter
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// This is part of the <see cref="IOptionHandler"/> delayed object
+ /// activation scheme. The <see cref="ActivateOptions"/> method must
+ /// be called on this object after the configuration properties have
+ /// been set. Until <see cref="ActivateOptions"/> is called this
+ /// object is in an undefined state and must not be used.
+ /// </para>
+ /// <para>
+ /// If any of the configuration properties are modified then
+ /// <see cref="ActivateOptions"/> must be called again.
+ /// </para>
+ /// </remarks>
+ public void ActivateOptions()
+ {
+ if (Option == null)
+ return;
+
+ string optStr = Option.Trim();
+ if (optStr.Length != 0)
+ {
+ int stackLevelVal;
+ if (SystemInfo.TryParse(optStr, out stackLevelVal))
+ {
+ if (stackLevelVal <= 0)
+ {
+ LogLog.Error(declaringType, "StackTracePatternConverter: StackeFrameLevel option (" + optStr + ") isn't a positive integer.");
+ }
+ else
+ {
+ m_stackFrameLevel = stackLevelVal;
+ }
+ }
+ else
+ {
+ LogLog.Error(declaringType, "StackTracePatternConverter: StackFrameLevel option \"" + optStr + "\" not a decimal integer.");
+ }
+ }
+ }
+
+ /// <summary>
+ /// Write the strack frames to the output
+ /// </summary>
+ /// <param name="writer"><see cref="TextWriter" /> that will receive the formatted result.</param>
+ /// <param name="loggingEvent">the event being logged</param>
+ /// <remarks>
+ /// <para>
+ /// Writes the <see cref="LocationInfo.StackFrames"/> to the output writer.
+ /// </para>
+ /// </remarks>
+ override protected void Convert(TextWriter writer, LoggingEvent loggingEvent)
+ {
+ StackFrame[] stackframes = loggingEvent.LocationInformation.StackFrames;
+ if ((stackframes == null) || (stackframes.Length <= 0))
+ {
+ LogLog.Error(declaringType, "loggingEvent.LocationInformation.StackFrames was null or empty.");
+ return;
+ }
+
+ int stackFrameIndex = m_stackFrameLevel - 1;
+ while (stackFrameIndex >= 0)
+ {
+ if (stackFrameIndex > stackframes.Length)
+ {
+ stackFrameIndex--;
+ continue;
+ }
+
+ StackFrame stackFrame = stackframes[stackFrameIndex];
+ writer.Write("{0}.{1}", stackFrame.GetMethod().DeclaringType.Name, GetMethodInformation(stackFrame.GetMethod()));
+ if (stackFrameIndex > 0)
+ {
+ // TODO: make this user settable?
+ writer.Write(" > ");
+ }
+ stackFrameIndex--;
+ }
+ }
+
+ /// <summary>
+ /// Returns the Name of the method
+ /// </summary>
+ /// <param name="method"></param>
+ /// <remarks>This method was created, so this class could be used as a base class for StackTraceDetailPatternConverter</remarks>
+ /// <returns>string</returns>
+ internal virtual string GetMethodInformation(System.Reflection.MethodBase method)
+ {
+ return method.Name;
+ }
+
+ #region Private Static Fields
+
+ /// <summary>
+ /// The fully qualified type of the StackTracePatternConverter class.
+ /// </summary>
+ /// <remarks>
+ /// Used by the internal logger to record the Type of the
+ /// log message.
+ /// </remarks>
+ private readonly static Type declaringType = typeof(StackTracePatternConverter);
+
+ #endregion Private Static Fields
+ }
+}
Propchange: logging/log4net/trunk/src/Layout/Pattern/StackTracePatternConverter.cs
------------------------------------------------------------------------------
svn:eol-style = native
Modified: logging/log4net/trunk/src/Repository/ConfigurationChangedEventArgs.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Repository/ConfigurationChangedEventArgs.cs?rev=1158529&r1=1158528&r2=1158529&view=diff
==============================================================================
--- logging/log4net/trunk/src/Repository/ConfigurationChangedEventArgs.cs (original)
+++ logging/log4net/trunk/src/Repository/ConfigurationChangedEventArgs.cs Wed Aug 17 05:57:00 2011
@@ -1,30 +1,30 @@
-using System;
-using System.Collections;
-
-namespace log4net.Repository
-{
- /// <summary>
- ///
- /// </summary>
- public class ConfigurationChangedEventArgs : EventArgs
- {
- private readonly ICollection configurationMessages;
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="configurationMessages"></param>
- public ConfigurationChangedEventArgs(ICollection configurationMessages)
- {
- this.configurationMessages = configurationMessages;
- }
-
- /// <summary>
- ///
- /// </summary>
- public ICollection ConfigurationMessages
- {
- get { return configurationMessages; }
- }
- }
+using System;
+using System.Collections;
+
+namespace log4net.Repository
+{
+ /// <summary>
+ ///
+ /// </summary>
+ public class ConfigurationChangedEventArgs : EventArgs
+ {
+ private readonly ICollection configurationMessages;
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="configurationMessages"></param>
+ public ConfigurationChangedEventArgs(ICollection configurationMessages)
+ {
+ this.configurationMessages = configurationMessages;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ public ICollection ConfigurationMessages
+ {
+ get { return configurationMessages; }
+ }
+ }
}
\ No newline at end of file
Propchange: logging/log4net/trunk/src/Repository/ConfigurationChangedEventArgs.cs
------------------------------------------------------------------------------
svn:eol-style = native
Modified: logging/log4net/trunk/src/Util/ConverterInfo.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/ConverterInfo.cs?rev=1158529&r1=1158528&r2=1158529&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/ConverterInfo.cs (original)
+++ logging/log4net/trunk/src/Util/ConverterInfo.cs Wed Aug 17 05:57:00 2011
@@ -1,73 +1,73 @@
-using System;
-
-namespace log4net.Util
-{
- /// <summary>
- /// Wrapper class used to map converter names to converter types
- /// </summary>
- /// <remarks>
- /// <para>
- /// Pattern converter info class used during configuration by custom
- /// PatternString and PatternLayer converters.
- /// </para>
- /// </remarks>
- public sealed class ConverterInfo
- {
- private string m_name;
- private Type m_type;
- private readonly PropertiesDictionary properties = new PropertiesDictionary();
-
- /// <summary>
- /// default constructor
- /// </summary>
- public ConverterInfo()
- {
- }
-
- /// <summary>
- /// Gets or sets the name of the conversion pattern
- /// </summary>
- /// <remarks>
- /// <para>
- /// The name of the pattern in the format string
- /// </para>
- /// </remarks>
- public string Name
- {
- get { return m_name; }
- set { m_name = value; }
- }
-
- /// <summary>
- /// Gets or sets the type of the converter
- /// </summary>
- /// <remarks>
- /// <para>
- /// The value specified must extend the
- /// <see cref="PatternConverter"/> type.
- /// </para>
- /// </remarks>
- public Type Type
- {
- get { return m_type; }
- set { m_type = value; }
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="entry"></param>
- public void AddProperty(PropertyEntry entry)
- {
- properties[entry.Key] = entry.Value;
- }
-
- /// <summary>
- ///
- /// </summary>
- public PropertiesDictionary Properties
- {
- get { return properties; }
- }
- }
-}
+using System;
+
+namespace log4net.Util
+{
+ /// <summary>
+ /// Wrapper class used to map converter names to converter types
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Pattern converter info class used during configuration by custom
+ /// PatternString and PatternLayer converters.
+ /// </para>
+ /// </remarks>
+ public sealed class ConverterInfo
+ {
+ private string m_name;
+ private Type m_type;
+ private readonly PropertiesDictionary properties = new PropertiesDictionary();
+
+ /// <summary>
+ /// default constructor
+ /// </summary>
+ public ConverterInfo()
+ {
+ }
+
+ /// <summary>
+ /// Gets or sets the name of the conversion pattern
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// The name of the pattern in the format string
+ /// </para>
+ /// </remarks>
+ public string Name
+ {
+ get { return m_name; }
+ set { m_name = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the type of the converter
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// The value specified must extend the
+ /// <see cref="PatternConverter"/> type.
+ /// </para>
+ /// </remarks>
+ public Type Type
+ {
+ get { return m_type; }
+ set { m_type = value; }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="entry"></param>
+ public void AddProperty(PropertyEntry entry)
+ {
+ properties[entry.Key] = entry.Value;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ public PropertiesDictionary Properties
+ {
+ get { return properties; }
+ }
+ }
+}
Propchange: logging/log4net/trunk/src/Util/ConverterInfo.cs
------------------------------------------------------------------------------
svn:eol-style = native
Modified: logging/log4net/trunk/src/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs?rev=1158529&r1=1158528&r2=1158529&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs (original)
+++ logging/log4net/trunk/src/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs Wed Aug 17 05:57:00 2011
@@ -1,98 +1,98 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-#endregion
-
-#if !NETCF
-
-using System;
-using System.IO;
-
-namespace log4net.Util.PatternStringConverters
-{
- /// <summary>
- /// Write an <see cref="System.Environment.SpecialFolder" /> folder path to the output
- /// </summary>
- /// <remarks>
- /// <para>
- /// Write an special path environment folder path to the output writer.
- /// The value of the <see cref="log4net.Util.PatternConverter.Option"/> determines
- /// the name of the variable to output. <see cref="log4net.Util.PatternConverter.Option"/>
- /// should be a value in the <see cref="System.Environment.SpecialFolder" /> enumeration.
- /// </para>
- /// </remarks>
- /// <author>Ron Grabowski</author>
- internal sealed class EnvironmentFolderPathPatternConverter : PatternConverter
- {
- /// <summary>
- /// Write an special path environment folder path to the output
- /// </summary>
- /// <param name="writer">the writer to write to</param>
- /// <param name="state">null, state is not set</param>
- /// <remarks>
- /// <para>
- /// Writes the special path environment folder path to the output <paramref name="writer"/>.
- /// The name of the special path environment folder path to output must be set
- /// using the <see cref="log4net.Util.PatternConverter.Option"/>
- /// property.
- /// </para>
- /// </remarks>
- override protected void Convert(TextWriter writer, object state)
- {
- try
- {
- if (Option != null && Option.Length > 0)
- {
- Environment.SpecialFolder specialFolder =
- (Environment.SpecialFolder)Enum.Parse(typeof(Environment.SpecialFolder), Option, true);
-
- string envFolderPathValue = Environment.GetFolderPath(specialFolder);
- if (envFolderPathValue != null && envFolderPathValue.Length > 0)
- {
- writer.Write(envFolderPathValue);
- }
- }
- }
- catch (System.Security.SecurityException secEx)
- {
- // This security exception will occur if the caller does not have
- // unrestricted environment permission. If this occurs the expansion
- // will be skipped with the following warning message.
- LogLog.Debug(declaringType, "Security exception while trying to expand environment variables. Error Ignored. No Expansion.", secEx);
- }
- catch (Exception ex)
- {
- LogLog.Error(declaringType, "Error occurred while converting environment variable.", ex);
- }
- }
-
- #region Private Static Fields
-
- /// <summary>
- /// The fully qualified type of the EnvironmentFolderPathPatternConverter class.
- /// </summary>
- /// <remarks>
- /// Used by the internal logger to record the Type of the
- /// log message.
- /// </remarks>
- private readonly static Type declaringType = typeof(EnvironmentFolderPathPatternConverter);
-
- #endregion Private Static Fields
- }
-}
-
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion
+
+#if !NETCF
+
+using System;
+using System.IO;
+
+namespace log4net.Util.PatternStringConverters
+{
+ /// <summary>
+ /// Write an <see cref="System.Environment.SpecialFolder" /> folder path to the output
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Write an special path environment folder path to the output writer.
+ /// The value of the <see cref="log4net.Util.PatternConverter.Option"/> determines
+ /// the name of the variable to output. <see cref="log4net.Util.PatternConverter.Option"/>
+ /// should be a value in the <see cref="System.Environment.SpecialFolder" /> enumeration.
+ /// </para>
+ /// </remarks>
+ /// <author>Ron Grabowski</author>
+ internal sealed class EnvironmentFolderPathPatternConverter : PatternConverter
+ {
+ /// <summary>
+ /// Write an special path environment folder path to the output
+ /// </summary>
+ /// <param name="writer">the writer to write to</param>
+ /// <param name="state">null, state is not set</param>
+ /// <remarks>
+ /// <para>
+ /// Writes the special path environment folder path to the output <paramref name="writer"/>.
+ /// The name of the special path environment folder path to output must be set
+ /// using the <see cref="log4net.Util.PatternConverter.Option"/>
+ /// property.
+ /// </para>
+ /// </remarks>
+ override protected void Convert(TextWriter writer, object state)
+ {
+ try
+ {
+ if (Option != null && Option.Length > 0)
+ {
+ Environment.SpecialFolder specialFolder =
+ (Environment.SpecialFolder)Enum.Parse(typeof(Environment.SpecialFolder), Option, true);
+
+ string envFolderPathValue = Environment.GetFolderPath(specialFolder);
+ if (envFolderPathValue != null && envFolderPathValue.Length > 0)
+ {
+ writer.Write(envFolderPathValue);
+ }
+ }
+ }
+ catch (System.Security.SecurityException secEx)
+ {
+ // This security exception will occur if the caller does not have
+ // unrestricted environment permission. If this occurs the expansion
+ // will be skipped with the following warning message.
+ LogLog.Debug(declaringType, "Security exception while trying to expand environment variables. Error Ignored. No Expansion.", secEx);
+ }
+ catch (Exception ex)
+ {
+ LogLog.Error(declaringType, "Error occurred while converting environment variable.", ex);
+ }
+ }
+
+ #region Private Static Fields
+
+ /// <summary>
+ /// The fully qualified type of the EnvironmentFolderPathPatternConverter class.
+ /// </summary>
+ /// <remarks>
+ /// Used by the internal logger to record the Type of the
+ /// log message.
+ /// </remarks>
+ private readonly static Type declaringType = typeof(EnvironmentFolderPathPatternConverter);
+
+ #endregion Private Static Fields
+ }
+}
+
#endif // !NETCF
\ No newline at end of file
Propchange: logging/log4net/trunk/src/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs
------------------------------------------------------------------------------
svn:eol-style = native
Modified: logging/log4net/trunk/src/Util/PropertyEntry.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/PropertyEntry.cs?rev=1158529&r1=1158528&r2=1158529&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/PropertyEntry.cs (original)
+++ logging/log4net/trunk/src/Util/PropertyEntry.cs Wed Aug 17 05:57:00 2011
@@ -1,59 +1,59 @@
-namespace log4net.Util
-{
- /// <summary>
- /// A class to hold the key and data for a property set in the config file
- /// </summary>
- /// <remarks>
- /// <para>
- /// A class to hold the key and data for a property set in the config file
- /// </para>
- /// </remarks>
- public class PropertyEntry
- {
- private string m_key = null;
- private object m_value = null;
-
- /// <summary>
- /// Property Key
- /// </summary>
- /// <value>
- /// Property Key
- /// </value>
- /// <remarks>
- /// <para>
- /// Property Key.
- /// </para>
- /// </remarks>
- public string Key
- {
- get { return m_key; }
- set { m_key = value; }
- }
-
- /// <summary>
- /// Property Value
- /// </summary>
- /// <value>
- /// Property Value
- /// </value>
- /// <remarks>
- /// <para>
- /// Property Value.
- /// </para>
- /// </remarks>
- public object Value
- {
- get { return m_value; }
- set { m_value = value; }
- }
-
- /// <summary>
- /// Override <c>Object.ToString</c> to return sensible debug info
- /// </summary>
- /// <returns>string info about this object</returns>
- public override string ToString()
- {
- return "PropertyEntry(Key=" + m_key + ", Value=" + m_value + ")";
- }
- }
-}
+namespace log4net.Util
+{
+ /// <summary>
+ /// A class to hold the key and data for a property set in the config file
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// A class to hold the key and data for a property set in the config file
+ /// </para>
+ /// </remarks>
+ public class PropertyEntry
+ {
+ private string m_key = null;
+ private object m_value = null;
+
+ /// <summary>
+ /// Property Key
+ /// </summary>
+ /// <value>
+ /// Property Key
+ /// </value>
+ /// <remarks>
+ /// <para>
+ /// Property Key.
+ /// </para>
+ /// </remarks>
+ public string Key
+ {
+ get { return m_key; }
+ set { m_key = value; }
+ }
+
+ /// <summary>
+ /// Property Value
+ /// </summary>
+ /// <value>
+ /// Property Value
+ /// </value>
+ /// <remarks>
+ /// <para>
+ /// Property Value.
+ /// </para>
+ /// </remarks>
+ public object Value
+ {
+ get { return m_value; }
+ set { m_value = value; }
+ }
+
+ /// <summary>
+ /// Override <c>Object.ToString</c> to return sensible debug info
+ /// </summary>
+ /// <returns>string info about this object</returns>
+ public override string ToString()
+ {
+ return "PropertyEntry(Key=" + m_key + ", Value=" + m_value + ")";
+ }
+ }
+}
Propchange: logging/log4net/trunk/src/Util/PropertyEntry.cs
------------------------------------------------------------------------------
svn:eol-style = native
Modified: logging/log4net/trunk/src/Util/SystemStringFormat.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/SystemStringFormat.cs?rev=1158529&r1=1158528&r2=1158529&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/SystemStringFormat.cs (original)
+++ logging/log4net/trunk/src/Util/SystemStringFormat.cs Wed Aug 17 05:57:00 2011
@@ -1,231 +1,231 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-#endregion
-
-using System;
-using System.Text;
-using System.Xml;
-using System.Text.RegularExpressions;
-
-namespace log4net.Util
-{
- /// <summary>
- /// Utility class that represents a format string.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Utility class that represents a format string.
- /// </para>
- /// </remarks>
- /// <author>Nicko Cadell</author>
- public sealed class SystemStringFormat
- {
- private readonly IFormatProvider m_provider;
- private readonly string m_format;
- private readonly object[] m_args;
-
- #region Constructor
-
- /// <summary>
- /// Initialise the <see cref="SystemStringFormat"/>
- /// </summary>
- /// <param name="provider">An <see cref="System.IFormatProvider"/> that supplies culture-specific formatting information.</param>
- /// <param name="format">A <see cref="System.String"/> containing zero or more format items.</param>
- /// <param name="args">An <see cref="System.Object"/> array containing zero or more objects to format.</param>
- public SystemStringFormat(IFormatProvider provider, string format, params object[] args)
- {
- m_provider = provider;
- m_format = format;
- m_args = args;
- }
-
- #endregion Constructor
-
- /// <summary>
- /// Format the string and arguments
- /// </summary>
- /// <returns>the formatted string</returns>
- public override string ToString()
- {
- return StringFormat(m_provider, m_format, m_args);
- }
-
- #region StringFormat
-
- /// <summary>
- /// Replaces the format item in a specified <see cref="System.String"/> with the text equivalent
- /// of the value of a corresponding <see cref="System.Object"/> instance in a specified array.
- /// A specified parameter supplies culture-specific formatting information.
- /// </summary>
- /// <param name="provider">An <see cref="System.IFormatProvider"/> that supplies culture-specific formatting information.</param>
- /// <param name="format">A <see cref="System.String"/> containing zero or more format items.</param>
- /// <param name="args">An <see cref="System.Object"/> array containing zero or more objects to format.</param>
- /// <returns>
- /// A copy of format in which the format items have been replaced by the <see cref="System.String"/>
- /// equivalent of the corresponding instances of <see cref="System.Object"/> in args.
- /// </returns>
- /// <remarks>
- /// <para>
- /// This method does not throw exceptions. If an exception thrown while formatting the result the
- /// exception and arguments are returned in the result string.
- /// </para>
- /// </remarks>
- private static string StringFormat(IFormatProvider provider, string format, params object[] args)
- {
- try
- {
- // The format is missing, log null value
- if (format == null)
- {
- return null;
- }
-
- // The args are missing - should not happen unless we are called explicitly with a null array
- if (args == null)
- {
- return format;
- }
-
- // Try to format the string
- return String.Format(provider, format, args);
- }
- catch(Exception ex)
- {
- log4net.Util.LogLog.Warn(declaringType, "Exception while rendering format ["+format+"]", ex);
- return StringFormatError(ex, format, args);
- }
- catch
- {
- log4net.Util.LogLog.Warn(declaringType, "Exception while rendering format ["+format+"]");
- return StringFormatError(null, format, args);
- }
- }
-
- /// <summary>
- /// Process an error during StringFormat
- /// </summary>
- private static string StringFormatError(Exception formatException, string format, object[] args)
- {
- try
- {
- StringBuilder buf = new StringBuilder("<log4net.Error>");
-
- if (formatException != null)
- {
- buf.Append("Exception during StringFormat: ").Append(formatException.Message);
- }
- else
- {
- buf.Append("Exception during StringFormat");
- }
- buf.Append(" <format>").Append(format).Append("</format>");
- buf.Append("<args>");
- RenderArray(args, buf);
- buf.Append("</args>");
- buf.Append("</log4net.Error>");
-
- return buf.ToString();
- }
- catch(Exception ex)
- {
- log4net.Util.LogLog.Error(declaringType, "INTERNAL ERROR during StringFormat error handling", ex);
- return "<log4net.Error>Exception during StringFormat. See Internal Log.</log4net.Error>";
- }
- catch
- {
- log4net.Util.LogLog.Error(declaringType, "INTERNAL ERROR during StringFormat error handling");
- return "<log4net.Error>Exception during StringFormat. See Internal Log.</log4net.Error>";
- }
- }
-
- /// <summary>
- /// Dump the contents of an array into a string builder
- /// </summary>
- private static void RenderArray(Array array, StringBuilder buffer)
- {
- if (array == null)
- {
- buffer.Append(SystemInfo.NullText);
- }
- else
- {
- if (array.Rank != 1)
- {
- buffer.Append(array.ToString());
- }
- else
- {
- buffer.Append("{");
- int len = array.Length;
-
- if (len > 0)
- {
- RenderObject(array.GetValue(0), buffer);
- for (int i = 1; i < len; i++)
- {
- buffer.Append(", ");
- RenderObject(array.GetValue(i), buffer);
- }
- }
- buffer.Append("}");
- }
- }
- }
-
- /// <summary>
- /// Dump an object to a string
- /// </summary>
- private static void RenderObject(Object obj, StringBuilder buffer)
- {
- if (obj == null)
- {
- buffer.Append(SystemInfo.NullText);
- }
- else
- {
- try
- {
- buffer.Append(obj);
- }
- catch(Exception ex)
- {
- buffer.Append("<Exception: ").Append(ex.Message).Append(">");
- }
- catch
- {
- buffer.Append("<Exception>");
- }
- }
- }
-
- #endregion StringFormat
-
- #region Private Static Fields
-
- /// <summary>
- /// The fully qualified type of the SystemStringFormat class.
- /// </summary>
- /// <remarks>
- /// Used by the internal logger to record the Type of the
- /// log message.
- /// </remarks>
- private readonly static Type declaringType = typeof(SystemStringFormat);
-
- #endregion Private Static Fields
- }
-}
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion
+
+using System;
+using System.Text;
+using System.Xml;
+using System.Text.RegularExpressions;
+
+namespace log4net.Util
+{
+ /// <summary>
+ /// Utility class that represents a format string.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Utility class that represents a format string.
+ /// </para>
+ /// </remarks>
+ /// <author>Nicko Cadell</author>
+ public sealed class SystemStringFormat
+ {
+ private readonly IFormatProvider m_provider;
+ private readonly string m_format;
+ private readonly object[] m_args;
+
+ #region Constructor
+
+ /// <summary>
+ /// Initialise the <see cref="SystemStringFormat"/>
+ /// </summary>
+ /// <param name="provider">An <see cref="System.IFormatProvider"/> that supplies culture-specific formatting information.</param>
+ /// <param name="format">A <see cref="System.String"/> containing zero or more format items.</param>
+ /// <param name="args">An <see cref="System.Object"/> array containing zero or more objects to format.</param>
+ public SystemStringFormat(IFormatProvider provider, string format, params object[] args)
+ {
+ m_provider = provider;
+ m_format = format;
+ m_args = args;
+ }
+
+ #endregion Constructor
+
+ /// <summary>
+ /// Format the string and arguments
+ /// </summary>
+ /// <returns>the formatted string</returns>
+ public override string ToString()
+ {
+ return StringFormat(m_provider, m_format, m_args);
+ }
+
+ #region StringFormat
+
+ /// <summary>
+ /// Replaces the format item in a specified <see cref="System.String"/> with the text equivalent
+ /// of the value of a corresponding <see cref="System.Object"/> instance in a specified array.
+ /// A specified parameter supplies culture-specific formatting information.
+ /// </summary>
+ /// <param name="provider">An <see cref="System.IFormatProvider"/> that supplies culture-specific formatting information.</param>
+ /// <param name="format">A <see cref="System.String"/> containing zero or more format items.</param>
+ /// <param name="args">An <see cref="System.Object"/> array containing zero or more objects to format.</param>
+ /// <returns>
+ /// A copy of format in which the format items have been replaced by the <see cref="System.String"/>
+ /// equivalent of the corresponding instances of <see cref="System.Object"/> in args.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// This method does not throw exceptions. If an exception thrown while formatting the result the
+ /// exception and arguments are returned in the result string.
+ /// </para>
+ /// </remarks>
+ private static string StringFormat(IFormatProvider provider, string format, params object[] args)
+ {
+ try
+ {
+ // The format is missing, log null value
+ if (format == null)
+ {
+ return null;
+ }
+
+ // The args are missing - should not happen unless we are called explicitly with a null array
+ if (args == null)
+ {
+ return format;
+ }
+
+ // Try to format the string
+ return String.Format(provider, format, args);
+ }
+ catch(Exception ex)
+ {
+ log4net.Util.LogLog.Warn(declaringType, "Exception while rendering format ["+format+"]", ex);
+ return StringFormatError(ex, format, args);
+ }
+ catch
+ {
+ log4net.Util.LogLog.Warn(declaringType, "Exception while rendering format ["+format+"]");
+ return StringFormatError(null, format, args);
+ }
+ }
+
+ /// <summary>
+ /// Process an error during StringFormat
+ /// </summary>
+ private static string StringFormatError(Exception formatException, string format, object[] args)
+ {
+ try
+ {
+ StringBuilder buf = new StringBuilder("<log4net.Error>");
+
+ if (formatException != null)
+ {
+ buf.Append("Exception during StringFormat: ").Append(formatException.Message);
+ }
+ else
+ {
+ buf.Append("Exception during StringFormat");
+ }
+ buf.Append(" <format>").Append(format).Append("</format>");
+ buf.Append("<args>");
+ RenderArray(args, buf);
+ buf.Append("</args>");
+ buf.Append("</log4net.Error>");
+
+ return buf.ToString();
+ }
+ catch(Exception ex)
+ {
+ log4net.Util.LogLog.Error(declaringType, "INTERNAL ERROR during StringFormat error handling", ex);
+ return "<log4net.Error>Exception during StringFormat. See Internal Log.</log4net.Error>";
+ }
+ catch
+ {
+ log4net.Util.LogLog.Error(declaringType, "INTERNAL ERROR during StringFormat error handling");
+ return "<log4net.Error>Exception during StringFormat. See Internal Log.</log4net.Error>";
+ }
+ }
+
+ /// <summary>
+ /// Dump the contents of an array into a string builder
+ /// </summary>
+ private static void RenderArray(Array array, StringBuilder buffer)
+ {
+ if (array == null)
+ {
+ buffer.Append(SystemInfo.NullText);
+ }
+ else
+ {
+ if (array.Rank != 1)
+ {
+ buffer.Append(array.ToString());
+ }
+ else
+ {
+ buffer.Append("{");
+ int len = array.Length;
+
+ if (len > 0)
+ {
+ RenderObject(array.GetValue(0), buffer);
+ for (int i = 1; i < len; i++)
+ {
+ buffer.Append(", ");
+ RenderObject(array.GetValue(i), buffer);
+ }
+ }
+ buffer.Append("}");
+ }
+ }
+ }
+
+ /// <summary>
+ /// Dump an object to a string
+ /// </summary>
+ private static void RenderObject(Object obj, StringBuilder buffer)
+ {
+ if (obj == null)
+ {
+ buffer.Append(SystemInfo.NullText);
+ }
+ else
+ {
+ try
+ {
+ buffer.Append(obj);
+ }
+ catch(Exception ex)
+ {
+ buffer.Append("<Exception: ").Append(ex.Message).Append(">");
+ }
+ catch
+ {
+ buffer.Append("<Exception>");
+ }
+ }
+ }
+
+ #endregion StringFormat
+
+ #region Private Static Fields
+
+ /// <summary>
+ /// The fully qualified type of the SystemStringFormat class.
+ /// </summary>
+ /// <remarks>
+ /// Used by the internal logger to record the Type of the
+ /// log message.
+ /// </remarks>
+ private readonly static Type declaringType = typeof(SystemStringFormat);
+
+ #endregion Private Static Fields
+ }
+}
Propchange: logging/log4net/trunk/src/Util/SystemStringFormat.cs
------------------------------------------------------------------------------
svn:eol-style = native
Modified: logging/log4net/trunk/src/assembly/bin.xml
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/assembly/bin.xml?rev=1158529&r1=1158528&r2=1158529&view=diff
==============================================================================
--- logging/log4net/trunk/src/assembly/bin.xml (original)
+++ logging/log4net/trunk/src/assembly/bin.xml Wed Aug 17 05:57:00 2011
@@ -33,7 +33,7 @@
<include>KEYS</include>
<include>LICENSE</include>
<include>NOTICE</include>
- <include>contribs/**</include>
+ <include>contribs/**</include>
<include>examples/**</include>
<include>src/assembly/**</include>
<include>src/changes/**</include>
@@ -41,10 +41,10 @@
<include>src/ntdll/**</include>
<include>src/performance/**</include>
<include>src/site/**</include>
- <include>tests/README</include>
- <include>tests/*.xml</include>
- <include>tests/*.sample</include>
- <include>tests/*.bat</include>
+ <include>tests/README</include>
+ <include>tests/*.xml</include>
+ <include>tests/*.sample</include>
+ <include>tests/*.bat</include>
<include>tests/input/**</include>
<include>tests/resources/**</include>
<include>tests/src/**</include>
Propchange: logging/log4net/trunk/src/assembly/bin.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: logging/log4net/trunk/src/changes/changes.xml
------------------------------------------------------------------------------
svn:eol-style = native