How can we improve NLog?
NLog .Net Logging 2 years ago • updated by j.verdurmen 1 year ago 1

Allow to configure the type to database parameters of Database target.

ATM those are now strings (varchar)


Andrés Gutiérrez 1 year ago • updated by j.verdurmen 5 months ago 2

I'm using NLog to write inside a Parallel loop. It's all right but in the description appear the method Name with Parallel convention. This is my result:

  • Parallel execute:
    • AttachEmailFACeProcess.<Process>b__2_0 =>
  • Normal execute:
    • AttachEmailFACeProcess.Process =>

I'm using this layout in NLog.config:

<layout xsi:type="SimpleLayout" text="${longdate} [${pad:padCharacter=0:padding=3:${threadid}}] [${pad:padding=-5:inner=${level:uppercase=true}}] ${stacktrace:topFrames=2:skipframes=1} => ${message} ${onexception:${newline}${separator-ex}${newline} ${exception:format=tostring} ${onexception:${newline}${separator-ex}}" />

It's possible to write the message as Normal execute?

Andre Soares 1 year ago • updated by j.verdurmen 5 months ago 2

In log4net we have an option <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> to enable writing log lines in an open file. I could not make it work with NLog. I think this does not exist.

If it really doesn't exist, it would be a great feature!

Anoni Muss 1 year ago • updated by j.verdurmen 5 months ago 1

If anyone knows of a good way to overcome the diy downside, having a Shared Project project in NLog would be nice.

The drawback is Shared Project can not have references or define conditional compilation symbols so the application must add whatever NLog needs. It's not difficult to add those manually, but if it can't be automagic it's probably best left to DIY.

I'm successfully using NLog in one application now as a Shared Project and haven't hit a snag yet (just did it today though). Besides references & conditional symbols mentioned above it was just one line to the <Item Group> in .projitems to get it running

<Compile Include="$(MSBuildThisFileDirectory)NLog\src\NLog\**\*.cs" Exclude="$(MSBuildThisFileDirectory)NLog\src\NLog\Resources\*;$(MSBuildThisFileDirectory)NLog\src\NLog\Properties\*" />

NLog .Net Logging 2 years ago • updated by j.verdurmen 2 years ago 0

NLog for C++ has been removed in 3.0. We like to reintroduce this if the community really likes it.

News posts about removal:

NLog .Net Logging 2 years ago 0

Filter / display duplicate messages

NLog .Net Logging 2 years ago 0
Configure NLog from string (containing XML)
j.verdurmen 2 years ago • updated 2 years ago 1

If we add something to the context, we have to remember which context we have added it. (global, thread)

It would be nice to have a context-render which search for the correct context and renders the first found.

The order should be something like:

Event (property) -> Thread -> ThreadLocal -> NDC -> Global -> Variable

So if we add "x" to the event (property) and the global context, printing "x" will print the one from the event.

  • The order should be also configurable.
  • It's unclear if the NDC should be in this list.