Could you post the complete appender node that is using this layout? 

--- Jon Finley <[EMAIL PROTECTED]> wrote:

> That line is loading the exception text inside the appropriate XML
> element.
> 
> Using UltraEdit to view the results.
> 
> If every element from the layout is removed, the only thing that
> shows up is
> the exception text. 
> 
> If elements are removed one at a time, I see the correct XML but
> still get
> the exception text appended to the output.
> 
> Jon
> 
> -----Original Message-----
> From: Ron Grabowski [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, September 15, 2005 3:41 PM
> To: Log4NET User
> Subject: RE: LayoutSkeleton Help
> 
> What about this line:
> 
>  writer.Write("<RenderedMessage>" + loggingEvent.RenderedMessage +
> "</message>");
> 
> Are you viewing the output in a browser or with a program like
> Notepad?
> 
> Have you tried removing all the elements and adding each one back one
> by one
> starting from the bottom?
> 
> --- Jon Finley <[EMAIL PROTECTED]> wrote:
> 
> > No, same issue Leo.  Thanks for the catch though, I'm sure it saved
> me 
> > from some troubleshooting down the road. ;-)
> >  
> > Jon
> > 
> > 
> >   _____
> > 
> > From: Hart, Leo [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, September 15, 2005 3:16 PM
> > To: Log4NET User
> > Subject: RE: LayoutSkeleton Help
> > 
> > 
> > It looks like you are missing a "<" in this line:
> > 
> > writer.Write("<ClassName>" +
> > loggingEvent.LocationInformation.ClassName + "/ClassName>");
> > 
> > Does that fix the problem?
> >  
> > 
> > -----Original Message-----
> > From: Jon Finley [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, September 15, 2005 4:13 PM
> > To: 'Log4NET User'
> > Subject: LayoutSkeleton Help
> > 
> > 
> > 
> > Hi,
> > 
> > I have a very simple Layout based on LayoutSkeleton that generates
> XML 
> > using the LoggingEvent values.  However; the exception text always 
> > prints at the end of the XML.  Is there a way to turn this off?
> > 
> > My Format routine is as follows:
> > 
> >                 public override void Format(TextWriter writer, 
> > LoggingEvent
> > loggingEvent)
> >                 {
> >                         writer.Write("<GSIEventLog>");
> >                 writer.Write("<Domain>" + loggingEvent.Domain + 
> > "</Domain>");
> >                     writer.Write("<ClassName>" + 
> > loggingEvent.LocationInformation.ClassName + "/ClassName>");
> >                 writer.Write("<RenderedMessage>" + 
> > loggingEvent.RenderedMessage + "</message>");
> >                         writer.Write("<HostName>" +
> > loggingEvent.LookupProperty("log4net:HostName").ToString()  + 
> > "</HostName>");
> >                         writer.Write("<Identity>" + 
> > loggingEvent.UserName + "</Identity>");
> >                         writer.Write("<LoggerName>" + 
> > loggingEvent.LoggerName + "</LoggerName>");
> >                         writer.Write("<ThreadName>" + 
> > loggingEvent.ThreadName + "</ThreadName>");
> >                         writer.Write("<TimeStamp>" + 
> > loggingEvent.TimeStamp
> > + "</TimeStamp>");
> >                         writer.Write("<EventId>" +
> > loggingEvent.LookupProperty("EventId").ToString() + "</EventId>");
> >                         writer.Write("<Message2>" +
> > loggingEvent.LookupProperty("Message").ToString() + "</Message2>");
> >                         writer.Write("<AppUser>" +
> > loggingEvent.LookupProperty("AppUser").ToString() + "</AppUser>");
> >                         writer.Write("<SourceId>" +
> > loggingEvent.LookupProperty("SourceId").ToString() +
> "</SourceId>");
> >                 writer.Write("<ExMessage>" + 
> > loggingEvent.ExceptionObject.Message + "</ExMessage>");
> >                     writer.Write("<ExStackTrace>" + 
> > loggingEvent.ExceptionObject.StackTrace + "</ExStackTrace>");
> >                         writer.Write("</GSIEventLog>");
> > 
> >                         writer.WriteLine();
> >                 }
> > 
> > 
> > The output is:
> >
>
<GSIEventLog><Domain>Test1.exe</Domain><ClassName>Test1.Form1/ClassName><Ren
> >
>
deredMessage>message</message><HostName>jon-lt</HostName><Identity>GSI\j
> deredMessage>finl
> >
>
ey</Identity><LoggerName>Test1.Form1</LoggerName><ThreadName>2516</ThreadNam
> > e><TimeStamp>9/15/2005 3:00:04
> >
>
PM</TimeStamp><EventId>1111</EventId><Message2>message</Message2><AppUser>jf
> > inley-AppUser</AppUser><SourceId></SourceId><ExMessage>Object
> > reference not
> > set to an instance of an object.</ExMessage><ExStackTrace>   at
> > Test1.Form1.btnLog4NetTest_Click(Object sender, EventArgs e) in 
> > C:\Development_NET\Test\Test1\Form1.vb:line
> > 236</ExStackTrace></GSIEventLog>
> > System.NullReferenceException: Object reference not set to an
> instance 
> > of an object.
> >    at Test1.Form1.btnLog4NetTest_Click(Object sender, EventArgs e)
> in 
> > C:\Development_NET\Test\Test1\Form1.vb:line 236
> > 
> > I would like the output to be:
> >
>
<GSIEventLog><Domain>Test1.exe</Domain><ClassName>Test1.Form1/ClassName><Ren
> >
>
deredMessage>message</message><HostName>jon-lt</HostName><Identity>GSI\j
> deredMessage>finl
> >
>
ey</Identity><LoggerName>Test1.Form1</LoggerName><ThreadName>2516</ThreadNam
> > e><TimeStamp>9/15/2005 3:00:04
> >
>
PM</TimeStamp><EventId>1111</EventId><Message2>message</Message2><AppUser>jf
> > inley-AppUser</AppUser><SourceId></SourceId><ExMessage>Object
> > reference not
> > set to an instance of an object.</ExMessage><ExStackTrace>   at
> > Test1.Form1.btnLog4NetTest_Click(Object sender, EventArgs e) in 
> > C:\Development_NET\Test\Test1\Form1.vb:line
> > 236</ExStackTrace></GSIEventLog>
> > 
> > 
> > Thank you,
> > 
> > Jon
> > 
> > 
> 
> 
> 
> 

Reply via email to