Permalink
Browse files

BUG 6548: Add exception information to log4j layout

  • Loading branch information...
jkowalski committed Nov 1, 2011
1 parent 443be87 commit 079dadd8dcc076df2ba555ee72f39de58e9e3922
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/NLog/LayoutRenderers/Log4JXmlEventLayoutRenderer.cs
@@ -190,6 +190,13 @@ protected override void Append(StringBuilder builder, LogEventInfo logEvent)
xtw.WriteElementString("log4j", "NDC", dummyNamespace, string.Join(this.NdcItemSeparator, NestedDiagnosticsContext.GetAllMessages()));
}
+ if (logEvent.Exception != null)
+ {
+ xtw.WriteStartElement("log4j", "throwable", dummyNamespace);
+ xtw.WriteCData(logEvent.Exception.ToString());
+ xtw.WriteEndElement();
+ }
+
#if !NET_CF
if (this.IncludeCallSite || this.IncludeSourceInfo)
{

0 comments on commit 079dadd

Please sign in to comment.