imlokesh imlokesh - 6 months ago 87
C# Question

How to clear MemoryTarget Logs in NLog?

I'm using a Memory Target for logging.

<target xsi:type="Memory" name="memLog" layout="${longdate} - ${message}" />

This is a log heavy application and eventually the log becomes very large and the application runs out of memory.

Is there any way to reset the
collection? It is a read-only property.


The MemoryTarget.Logs property implements IList. Why not just clear it like this: