c# - log4net custom appender message format is ignored -


I have implemented a custom Aepender ranging inherited from Apender skeleton. My logger instance is created correctly and the 'append' method is called when logging but the message is not formatted properly. I have used a different way by passing a StreamWriter example, but failed to write all its call streams. The second thing I've tried is using the RenderedMessage property but the returned value is the exact message without formatting the layout.

  protected override void attach (Log4netkCorekLoggingEvent Logingivent) {StreamWriter _writer = new streamers (new Memoristrym ()); RenderLoggingEvent (_writer, logging event); // logging persists position based on stream after writing event [Ba] [] Sndeshbfr = new byte [_writer.BaseStream.Position]; _writer.BaseStream.Read (MessageBuffer, 0, MessageBuffarLange); // Try reading from the stream reader made from the base stream; fails in var reader = new StreamReader (_writer.BaseStream); Var test = reader.ReadToEnd (); // variable test conversion pattern test = logging event. According to the random message, is not formatted correctly; } & Lt; Appender name = "test exception" type = "log4 net test app" & gt; & Lt; Layout type = "log4net.Layout.PatternLayout" & gt; & Lt; Rupantrnptl value = "[% Date] - [% Thread] - [% class] - [% logger] -% message% Nyalain" / & gt; & Lt; / Layout & gt; & Lt; / Appender & gt;  

Any ideas as to what is wrong?

Changing from the storage stream to the file stream is the correct layout, so there should be something with using the memory stream.

It appears that I need to flush the _writer. Once I was done it was right Stream status was found and all formatting was present.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -