Bram Van Den Bossche
Bram Van Den Bossche

Reputation: 21

NLog exception as data object

I'm using NLog for logging exceptions to different targets.

One of the targets displays an execption window (like visual studio). To do so I need the non rendered data of the exception. How should I setup the Layout for the target?

I have this to diassamble the exception to string:

[EXCEPTION]${exception:format=toString,Data:maxInnerExceptionLevel=10}

How to specify this to get the raw (serialized) data of the excepion ?

Upvotes: 0

Views: 214

Answers (1)

Rolf Kristensen
Rolf Kristensen

Reputation: 19867

The custom target should look at this property:

LogEventInfo.Exception

Upvotes: 2

Related Questions