This project has moved. For the latest updates, please go here.

How to view exception and stacktrace from NLog

Apr 3, 2012 at 8:52 AM

Does anyone know if it is possible to get exception and stacktrace information in Sentinel from NLog with the Logger.XXXException() methods?

I have googled and tried many different NLog configurations, but I still only get the message part showing in Sentinel. Supplying a custom layout does not seem to have any effect.

I have also tried Log2Console with Chainsaw protocol, but the best I could do there was sending exception as a separate log entry, but it did not turn out that well.

 

Coordinator
Apr 4, 2012 at 8:00 AM

Probably unlikely, Sentinel perfers incoming messages that use the built in xml or NLogViewer layouts.  If the exception information is not transmitted in the log entry, Sentinel will be unable to display it.  It all stems from how nLog sends the information - I've generally be unable with the xxxException classes and resorted to not using them!

I'll try and take a look - although finding a new day job is my focus! ;-)

 

 

Apr 4, 2012 at 8:08 AM
Thanks!
Great work on the log viewer, I really like it. A few bugs with scrolling in the viewer and not saving settings so far, but other than that it's great. I might want to contribute on this, but it's always about the time.

I created a stackoverflow question for this: http://stackoverflow.com/questions/9990591/how-to-log-exceptions-with-network-targets-in-nlog
My current workaround is to use a wrapper class that does string.format() to join message and exception text. This obviously works. And whenever I figure out how to use the Exception log methods correctly I can easily switch to that.

Where is the spec on the layout of the NLogViewer data? I'm assuming it is xml or similar. Does it even have an exception field?





On 04.04.2012 10:01, yarseyah wrote:

From: yarseyah

Probably unlikely, Sentinel perfers incoming messages that use the built in xml or NLogViewer layouts. If the exception information is not transmitted in the log entry, Sentinel will be unable to display it. It all stems from how nLog sends the information - I've generally be unable with the xxxException classes and resorted to not using them!

I'll try and take a look - although finding a new day job is my focus! ;-)

Coordinator
Apr 5, 2012 at 10:29 AM

Not sure if there is a specification, I used reverse engineering of what I had available.

It's possible that because it is XML and clients of the data will ignore anything they don't know, the author of nLog could add such data allowing me to hook onto it.