logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonas.Ba...@rohde-schwarz.com
Subject Fix for FileAppender's TextWriter creation in OpenFile
Date Mon, 22 Aug 2016 10:27:15 GMT

`FileAppender` has a vritual overload for the Method `SetQWForFiles` that 
takes a `Stream` and creates a StreamWriter from it. According to the API 
This method can be overridden by sub classes that want to wrap the
<see cref="Stream"/> in some way, for example to encrypt the output
data using a <c>System.Security.Cryptography.CryptoStream</c>. 

Unfortunately, it doesn't get called. Instead it is inlined in `OpenFile`, 
so derived classes have no chance in wrapping the stream before it is 
passed to the writer.
This trivial patch changes this.

--- C:/temp/FileAppender.cs-revBASE.svn003.tmp.cs       Sat Aug 13 
18:57:44 2016
+++ C:/Users/BAEHR/Documents/log4net-trunk/src/Appender/FileAppender.cs 
Mon Aug 22 11:59:41 2016
@@ -1382 +1382 @@ namespace log4net.Appender
-                                               SetQWForFiles(new 
StreamWriter(m_stream, m_encoding));
+                                               SetQWForFiles(m_stream);

Best Regards,
View raw message