Removed Context Lists. The Context Stacks give essentially the same functionality
Project: http://git-wip-us.apache.org/repos/asf/logging-log4net/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4net/commit/6aa28734 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4net/tree/6aa28734 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4net/diff/6aa28734 Branch: refs/heads/origin/trunk Commit: 6aa287347dafcb6f611465d1be6a8de14e92a071 Parents: 4fa09a4 Author: Nicko Cadell <ni...@apache.org> Authored: Mon Feb 14 03:24:37 2005 +0000 Committer: Nicko Cadell <ni...@apache.org> Committed: Mon Feb 14 03:24:37 2005 +0000 ---------------------------------------------------------------------- src/LogicalThreadContext.cs | 21 ----- src/ThreadContext.cs | 21 ----- src/Util/ThreadContextList.cs | 161 ------------------------------------ src/Util/ThreadContextLists.cs | 110 ------------------------ src/log4net.csproj | 10 --- 5 files changed, 323 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/6aa28734/src/LogicalThreadContext.cs ---------------------------------------------------------------------- diff --git a/src/LogicalThreadContext.cs b/src/LogicalThreadContext.cs index 1d449cd..7fc8e45 100755 --- a/src/LogicalThreadContext.cs +++ b/src/LogicalThreadContext.cs @@ -118,22 +118,6 @@ namespace log4net get { return s_stacks; } } - /// <summary> - /// The thread lists - /// </summary> - /// <value> - /// list map - /// </value> - /// <remarks> - /// <para> - /// The logical thread lists. - /// </para> - /// </remarks> - public static ThreadContextLists Lists - { - get { return s_lists; } - } - #endregion Public Static Properties #region Private Static Fields @@ -148,11 +132,6 @@ namespace log4net /// </summary> private readonly static ThreadContextStacks s_stacks = new ThreadContextStacks(s_properties); - /// <summary> - /// The thread context lists instance - /// </summary> - private readonly static ThreadContextLists s_lists = new ThreadContextLists(s_properties); - #endregion Private Static Fields } } http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/6aa28734/src/ThreadContext.cs ---------------------------------------------------------------------- diff --git a/src/ThreadContext.cs b/src/ThreadContext.cs index 7e6f7a1..8e24edc 100755 --- a/src/ThreadContext.cs +++ b/src/ThreadContext.cs @@ -115,22 +115,6 @@ namespace log4net get { return s_stacks; } } - /// <summary> - /// The thread lists - /// </summary> - /// <value> - /// list map - /// </value> - /// <remarks> - /// <para> - /// The thread local lists. - /// </para> - /// </remarks> - public static ThreadContextLists Lists - { - get { return s_lists; } - } - #endregion Public Static Properties #region Private Static Fields @@ -145,11 +129,6 @@ namespace log4net /// </summary> private readonly static ThreadContextStacks s_stacks = new ThreadContextStacks(s_properties); - /// <summary> - /// The thread context lists instance - /// </summary> - private readonly static ThreadContextLists s_lists = new ThreadContextLists(s_properties); - #endregion Private Static Fields } } http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/6aa28734/src/Util/ThreadContextList.cs ---------------------------------------------------------------------- diff --git a/src/Util/ThreadContextList.cs b/src/Util/ThreadContextList.cs deleted file mode 100755 index 5c4cab8..0000000 --- a/src/Util/ThreadContextList.cs +++ /dev/null @@ -1,161 +0,0 @@ -#region Copyright & License -// -// Copyright 2001-2005 The Apache Software Foundation -// -// Licensed 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.Collections; - -using log4net.Core; - -namespace log4net.Util -{ - /// <summary> - /// Implementation of List for the <see cref="log4net.ThreadContext"/> - /// </summary> - /// <remarks> - /// <para> - /// Implementation of List for the <see cref="log4net.ThreadContext"/> - /// </para> - /// </remarks> - /// <author>Nicko Cadell</author> - public sealed class ThreadContextList : IFixingRequired - { - #region Private Static Fields - - /// <summary> - /// The thread local data slot used to store the stack. - /// </summary> - private readonly ArrayList m_list = new ArrayList(); - - #endregion Private Static Fields - - #region Public Instance Constructors - - /// <summary> - /// Internal constructor - /// </summary> - /// <remarks> - /// <para> - /// Initializes a new instance of the <see cref="ThreadContextStack" /> class. - /// </para> - /// </remarks> - internal ThreadContextList() - { - } - - #endregion Public Instance Constructors - - #region Public Methods - - /// <summary> - /// Clears all the contextual information held in this list. - /// </summary> - /// <remarks> - /// <para> - /// Clears all the contextual information held in this list. - /// </para> - /// </remarks> - public void Clear() - { - m_list.Clear(); - } - - /// <summary> - /// Append a message to this list - /// </summary> - /// <param name="message">the message to append to this list</param> - /// <remarks> - /// <para> - /// Append a message to this list - /// </para> - /// </remarks> - public void Append(string message) - { - m_list.Add(message); - } - - #endregion Public Methods - - #region Internal Methods - - /// <summary> - /// Gets the current context information for this list. - /// </summary> - /// <returns>The current context information.</returns> - /// <remarks> - /// <para> - /// Gets the current context information for this list. - /// </para> - /// </remarks> - internal string GetFullMessage() - { - if (m_list.Count > 1) - { - // Build message using a string builder - - StringBuilder buf = new StringBuilder(); - - buf.Append((string)m_list[0]); - - for(int i=1; i<m_list.Count; i++) - { - buf.Append(' '); - buf.Append((string)m_list[i]); - } - - return buf.ToString(); - } - else if (m_list.Count == 1) - { - // Only one element, just return it - return (string)m_list[0]; - } - return null; - } - - #endregion Internal Methods - - /// <summary> - /// Gets the current context information for this list. - /// </summary> - /// <returns>Gets the current context information</returns> - /// <remarks> - /// <para> - /// Gets the current context information for this list. - /// </para> - /// </remarks> - public override string ToString() - { - return GetFullMessage(); - } - - /// <summary> - /// Get a portable version of this object - /// </summary> - /// <returns>the portable instance of this object</returns> - /// <remarks> - /// <para> - /// Get a portable version of this object - /// </para> - /// </remarks> - object IFixingRequired.GetFixedObject() - { - return GetFullMessage(); - } - } -} http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/6aa28734/src/Util/ThreadContextLists.cs ---------------------------------------------------------------------- diff --git a/src/Util/ThreadContextLists.cs b/src/Util/ThreadContextLists.cs deleted file mode 100755 index f4411bf..0000000 --- a/src/Util/ThreadContextLists.cs +++ /dev/null @@ -1,110 +0,0 @@ -#region Copyright & License -// -// Copyright 2001-2005 The Apache Software Foundation -// -// Licensed 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.Collections; - -namespace log4net.Util -{ - /// <summary> - /// Implementation of Lists collection for the <see cref="log4net.ThreadContext"/> - /// </summary> - /// <remarks> - /// <para> - /// Implementation of Lists collection for the <see cref="log4net.ThreadContext"/> - /// </para> - /// </remarks> - /// <author>Nicko Cadell</author> - public sealed class ThreadContextLists - { - private readonly ContextPropertiesBase m_properties; - - #region Public Instance Constructors - - /// <summary> - /// Internal constructor - /// </summary> - /// <remarks> - /// <para> - /// Initializes a new instance of the <see cref="ThreadContextLists" /> class. - /// </para> - /// </remarks> - internal ThreadContextLists(ContextPropertiesBase properties) - { - m_properties = properties; - } - - #endregion Public Instance Constructors - - #region Public Instance Properties - - /// <summary> - /// Gets the named list - /// </summary> - /// <value> - /// The named list - /// </value> - /// <remarks> - /// <para> - /// Gets the named list - /// </para> - /// </remarks> - public ThreadContextList this[string key] - { - get - { - ThreadContextList list = null; - - object propertyValue = m_properties[key]; - if (propertyValue == null) - { - // List does not exist, create - list = new ThreadContextList(); - m_properties[key] = list; - } - else - { - // Look for existing list - list = propertyValue as ThreadContextList; - if (list == null) - { - // Property is not set to a list! - string propertyValueString = "(null)"; - - try - { - propertyValueString = propertyValue.ToString(); - } - catch - { - } - - LogLog.Error("ThreadContextLists: Request for list named ["+key+"] failed because a property with the same name exists which is a ["+propertyValue.GetType().Name+"] with value ["+propertyValueString+"]"); - - list = new ThreadContextList(); - } - } - - return list; - } - } - - #endregion Public Instance Properties - } -} - http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/6aa28734/src/log4net.csproj ---------------------------------------------------------------------- diff --git a/src/log4net.csproj b/src/log4net.csproj index 67c6385..340a938 100755 --- a/src/log4net.csproj +++ b/src/log4net.csproj @@ -948,16 +948,6 @@ BuildAction = "Compile" /> <File - RelPath = "Util\ThreadContextList.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File - RelPath = "Util\ThreadContextLists.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "Util\ThreadContextProperties.cs" SubType = "Code" BuildAction = "Compile"