Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

BUG 6548: Add exception information to log4j layout

  • Loading branch information...
commit 079dadd8dcc076df2ba555ee72f39de58e9e3922 1 parent 443be87
@jkowalski authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/NLog/LayoutRenderers/Log4JXmlEventLayoutRenderer.cs
View
7 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)
{
Please sign in to comment.
Something went wrong with that request. Please try again.