FreeAndNil commented on issue #225:
URL: 
https://github.com/apache/logging-log4net/issues/225#issuecomment-2633396558

   Hi @sita-martin,
   
   I created a test to reproduce your problem.
   
   ```csharp
   [Test]
   public void LogExceptionTest()
   {
     XmlLayoutSchemaLog4J layout = new();
     StringAppender stringAppender = new() { Layout = layout };
   
     ILoggerRepository rep = 
LogManager.CreateRepository(Guid.NewGuid().ToString());
     BasicConfigurator.Configure(rep, stringAppender);
     ILog log1 = LogManager.GetLogger(rep.Name, "TestLogger");
     Bar(42);
   
     var x = stringAppender.GetString();
   
     void Bar(int foo)
     {
       try
       {
         throw new TimeoutException();
       }
       catch (TimeoutException ex)
       {
         log1.Error(string.Format("Error {0}", foo), ex);
       }
     }
   }
   ```
   
   This test gives me the same result for 2.0.17 and 3.0.3.
   ```xml
   <log4j:event logger="TestLogger" timestamp="1738662416975" level="ERROR" 
thread="17">
     <log4j:message>Error 42</log4j:message>
     <log4j:properties>
       <log4j:data name="log4net:HostName" value="pcname"/>
       <log4j:data name="log4jmachinename" value="pcname"/>
       <log4j:data name="log4japp" value="domain-c35c8fe6-log4net.Tests.dll"/>
       <log4j:data name="log4net:UserName" value="username"/>
     </log4j:properties>
     <log4j:throwable><![CDATA[System.TimeoutException: The operation has timed 
out.
      at 
log4net.Tests.Layout.XmlLayoutSchemaLog4jTest.<LogExceptionTest>g__Bar|0_0(Int32
 foo, <>c__DisplayClass0_0& ) in 
X:\logging-log4net\src\log4net.Tests\Layout\XmlLayoutSchemaLog4jTest.cs:line 
51]]></log4j:throwable>
   </log4j:event>
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to