Xilmiki
Xilmiki

Reputation: 1502

NLog Truncate StackTrace

I'm trying to limit StackTrace lenght in Nlog (https://nlog-project.org/) message

This is my working format string

${longdate} #${uppercase:${level}}# ${when:when=level>=LogLevel.Error:inner=${callsite} ${callsite-linenumber}:else=} ${message} ${onexception:EXCEPTION \:${exception:format=message,StackTrace}}

I know there are a "truncate" parameter

${message:truncate=1000}

I have tried in many ways but never get the desired result (can't find any documentation or example)

Can anyone help me?

Upvotes: 1

Views: 271

Answers (1)

Julian
Julian

Reputation: 36750

I think you're looking for ${left}:

${onexception:EXCEPTION \:${left:inner=${exception:format=message,StackTrace}:length=1000}}}

Upvotes: 1

Related Questions