'Log4net xml output

I want full control over log4net xml output.

How is it possible to customize the output template?



Solution 1:[1]

Adding to Darin's answer, in log4net 2.0.8, I had to change the layout a little:

<layout type="MyNamespace.MyClass, MyNamespace"/>

I found this here https://www.codewrecks.com/post/old/2008/04/writing-a-custom-formatter-for-log4net/

Solution 2:[2]

Check out the XmlLayoutBase class. I think thats probably what you need. There's a FormatXML function you will need to override to supply the XmlWriter with the correctly formatted data.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Stephen Ostermiller
Solution 2 Russell Troywest