It looks like the buffer passed to WriteConsoleW is limited to 64KB, i.e. 32000 WCHARs less 1 for the NULL if the P/Invoke marshalling feels like putting one on the end of the string.
I will update the appender along the lines of your patch. Thanks, Nicko > -----Original Message----- > From: Wesley Smith [mailto:[EMAIL PROTECTED] > Sent: 27 January 2005 20:03 > To: log4net-dev@logging.apache.org > Subject: Patch to allow large messages to be logged via > ColoredConsoleAppender > > I found that if you attempt to log a message of more than > about 26000 characters, ColoredConsoleAppender will not log > the message (no error, just silently eats the message). One > possible fix for the problem is given in the patch below: > > > --- C:\TEMP\log4net-1.2.0-beta8\src\Appender\ColoredConsoleAppender.cs > Mon Jul 07 01:05:02 2003 > +++ C:\Program > Files\log4net\log4net-1.2.0-beta8\src\Appender\ColoredConsoleA > ppender.cs > Wed Jan 26 12:57:22 2005 > @@ -280,13 +280,32 @@ > > string strLoggingMessage = > RenderLoggingEvent(loggingEvent); > > - // write the output. > UInt32 uiWritten = 0; > + > + // WriteConsoleW can only handle a limited > number of characters at a time > + // and emperically, 26000 is about right. > + const int maxChunkSize = 26000; > + while (strLoggingMessage.Length > maxChunkSize) > + { > + string firstPart = > strLoggingMessage.Substring(0, maxChunkSize); > + WriteConsoleW( iConsoleHandle, > + firstPart, > + (UInt32)firstPart.Length, > + out (UInt32)uiWritten, > + IntPtr.Zero); > + > + // Remove the characters already output > from strLoggingMessage > + strLoggingMessage = > strLoggingMessage.Substring(maxChunkSize); > + > + } > + // write the remaining output. > + > WriteConsoleW( iConsoleHandle, > > strLoggingMessage, > > (UInt32)strLoggingMessage.Length, > out > (UInt32)uiWritten, > IntPtr.Zero); > + > } > > /// <summary> >