You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by fr...@apache.org on 2024/09/18 21:16:58 UTC

(logging-log4net) branch Feature/183-fix-pattern-string-for-filename updated (ad9e5351 -> d889c80c)

This is an automated email from the ASF dual-hosted git repository.

freeandnil pushed a change to branch Feature/183-fix-pattern-string-for-filename
in repository https://gitbox.apache.org/repos/asf/logging-log4net.git


 discard ad9e5351 a converter can implement IConvertTo AND IConvertFrom (fixes #183)
     new d889c80c a converter can implement IConvertTo AND IConvertFrom (fixes #183)

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (ad9e5351)
            \
             N -- N -- N   refs/heads/Feature/183-fix-pattern-string-for-filename (d889c80c)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/log4net/Repository/Hierarchy/XmlHierarchyConfigurator.cs | 3 ---
 1 file changed, 3 deletions(-)


(logging-log4net) 01/01: a converter can implement IConvertTo AND IConvertFrom (fixes #183)

Posted by fr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

freeandnil pushed a commit to branch Feature/183-fix-pattern-string-for-filename
in repository https://gitbox.apache.org/repos/asf/logging-log4net.git

commit d889c80c9dabf72ceebdc01f25ffa1f18fd076e5
Author: Jan Friedrich <fr...@apache.org>
AuthorDate: Wed Sep 18 23:13:31 2024 +0200

    a converter can implement IConvertTo AND IConvertFrom (fixes #183)
---
 src/log4net.Tests/Appender/FileAppenderTest.cs     |  2 -
 .../Util/TypeConverters/ConverterRegistry.cs       | 55 ++++++----------------
 src/site/xdoc/release/release-notes.xml            |  3 +-
 3 files changed, 16 insertions(+), 44 deletions(-)

diff --git a/src/log4net.Tests/Appender/FileAppenderTest.cs b/src/log4net.Tests/Appender/FileAppenderTest.cs
index 709aa5ee..58bcf5c4 100644
--- a/src/log4net.Tests/Appender/FileAppenderTest.cs
+++ b/src/log4net.Tests/Appender/FileAppenderTest.cs
@@ -92,8 +92,6 @@ public sealed class FileAppenderTest
 """);
       ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString());
       XmlConfigurator.Configure(rep, log4netConfig["log4net"]!);
-      ILog log = LogManager.GetLogger(rep.Name, "GeneralFileAppender");
-      log.Info("Message");
     }
     finally
     {
diff --git a/src/log4net/Util/TypeConverters/ConverterRegistry.cs b/src/log4net/Util/TypeConverters/ConverterRegistry.cs
index fb0b4cad..5837db82 100644
--- a/src/log4net/Util/TypeConverters/ConverterRegistry.cs
+++ b/src/log4net/Util/TypeConverters/ConverterRegistry.cs
@@ -27,8 +27,7 @@ namespace log4net.Util.TypeConverters
   /// </summary>
   /// <remarks>
   /// <para>
-  /// Maintains a registry of type converters used to convert between
-  /// types.
+  /// Maintains a registry of type converters used to convert between types.
   /// </para>
   /// <para>
   /// Use the <see cref="M:AddConverter(Type, object)"/> and 
@@ -44,13 +43,8 @@ namespace log4net.Util.TypeConverters
   public static class ConverterRegistry
   {
     /// <summary>
-    /// Static constructor.
+    /// This class constructor adds the intrinsic type converters
     /// </summary>
-    /// <remarks>
-    /// <para>
-    /// This constructor defines the intrinsic type converters.
-    /// </para>
-    /// </remarks>
     static ConverterRegistry()
     {
       // Add predefined converters here
@@ -67,23 +61,19 @@ namespace log4net.Util.TypeConverters
     /// </summary>
     /// <param name="destinationType">The type being converted to.</param>
     /// <param name="converter">The type converter to use to convert to the destination type.</param>
-    /// <remarks>
-    /// <para>
-    /// Adds a converter instance for a specific type.
-    /// </para>
-    /// </remarks>
     public static void AddConverter(Type? destinationType, object? converter)
     {
-      if (destinationType is not null && converter is not null)
+      if (destinationType is null || converter is null)
       {
-        if (converter is IConvertTo convertTo)
-        {
-          s_type2ConvertTo[destinationType] = convertTo;
-        }
-        else if (converter is IConvertFrom convertFrom)
-        {
-          s_type2ConvertFrom[destinationType] = convertFrom;
-        }
+        return;
+      }
+      if (converter is IConvertTo convertTo)
+      {
+        s_type2ConvertTo[destinationType] = convertTo;
+      }
+      if (converter is IConvertFrom convertFrom)
+      {
+        s_type2ConvertFrom[destinationType] = convertFrom;
       }
     }
 
@@ -92,15 +82,8 @@ namespace log4net.Util.TypeConverters
     /// </summary>
     /// <param name="destinationType">The type being converted to.</param>
     /// <param name="converterType">The type of the type converter to use to convert to the destination type.</param>
-    /// <remarks>
-    /// <para>
-    /// Adds a converter <see cref="Type"/> for a specific type.
-    /// </para>
-    /// </remarks>
     public static void AddConverter(Type destinationType, Type converterType)
-    {
-      AddConverter(destinationType, CreateConverterInstance(converterType));
-    }
+      => AddConverter(destinationType, CreateConverterInstance(converterType));
 
     /// <summary>
     /// Gets the type converter to use to convert values to the destination type.
@@ -111,11 +94,6 @@ namespace log4net.Util.TypeConverters
     /// The type converter instance to use for type conversions or <c>null</c> 
     /// if no type converter is found.
     /// </returns>
-    /// <remarks>
-    /// <para>
-    /// Gets the type converter to use to convert values to the destination type.
-    /// </para>
-    /// </remarks>
     public static IConvertTo? GetConvertTo(Type sourceType, Type destinationType)
     {
       // TODO: Support inheriting type converters.
@@ -146,11 +124,6 @@ namespace log4net.Util.TypeConverters
     /// The type converter instance to use for type conversions or <c>null</c> 
     /// if no type converter is found.
     /// </returns>
-    /// <remarks>
-    /// <para>
-    /// Gets the type converter to use to convert values to the destination type.
-    /// </para>
-    /// </remarks>
     public static IConvertFrom? GetConvertFrom(Type destinationType)
     {
       // TODO: Support inheriting type converters.
@@ -248,4 +221,4 @@ namespace log4net.Util.TypeConverters
     private static readonly ConcurrentDictionary<Type, IConvertTo> s_type2ConvertTo = new();
     private static readonly ConcurrentDictionary<Type, IConvertFrom> s_type2ConvertFrom = new();
   }
-}
+}
\ No newline at end of file
diff --git a/src/site/xdoc/release/release-notes.xml b/src/site/xdoc/release/release-notes.xml
index 180affb4..2abc2ef1 100644
--- a/src/site/xdoc/release/release-notes.xml
+++ b/src/site/xdoc/release/release-notes.xml
@@ -28,7 +28,8 @@ limitations under the License.
         <section id="a3.0.1-bug" name="Bug fixes">
           <ul>
             <li>
-              <a href="https://github.com/apache/logging-log4net/issues/tbd">tbd</a> (by tbd)
+              <a href="https://github.com/apache/logging-log4net/issues/183">Unable to set property [file] on object [log4net.Appender.FileAppender]</a>
+              (reported by @sc-mk fixed by @FreeAndNil in https://github.com/apache/logging-log4net/pull/176)
             </li>
           </ul>
         </section><section id="a3.0.1-enhancements" name="Enhancements">