Nlog: Going from log4net to NLOG

Created on 16 Mar 2019  路  3Comments  路  Source: NLog/NLog

Hello,

As the title says, I'm going from log4net to NLOG.

Everything configured successfully but got problems with pattern layout.

log4net pattern layout
xaml %8level| %8timestamp| %5.5thread| %10.20logger{1}| %message%newline

How do I write this pattern layout in nlog?
Currently Getting problems with empty spaces and also cannot find timestamp pattern.

question

Most helpful comment

The simple conversion would be this:

${level}|${longdate}|${threadid}|${logger}|${message}${exception:format=tostring}

If you want the padding:

${level:padding=5}| ${time:invariant=true}| ${threadid:padding=5}| ${logger}| ${message}${exception:format=tostring}

All 3 comments

The simple conversion would be this:

${level}|${longdate}|${threadid}|${logger}|${message}${exception:format=tostring}

If you want the padding:

${level:padding=5}| ${time:invariant=true}| ${threadid:padding=5}| ${logger}| ${message}${exception:format=tostring}

Hi!

I could recommended to read:

And (searchable) list of all options: https://nlog-project.org/config/?tab=layout-renderers

Thank you

Was this page helpful?
0 / 5 - 0 ratings

Related issues

imanushin picture imanushin  路  3Comments

imanushin picture imanushin  路  3Comments

sszost picture sszost  路  3Comments

carkov1990 picture carkov1990  路  3Comments

npandrei picture npandrei  路  3Comments