| ThreadAgnosticAttribute Class |
Marks the layout or layout renderer as thread independent - it producing correct results
regardless of the thread it's running on.
Without this attribute everything is rendered on the main thread.
Inheritance Hierarchy SystemObject
SystemAttribute
NLog.ConfigThreadAgnosticAttribute
Namespace:
NLog.Config
Assembly:
NLog (in NLog.dll) Version: 5.3.4+73d83d3161d31288ca5c554cc50d27b6bed5f28b
Syntax public sealed class ThreadAgnosticAttribute : Attribute
Public NotInheritable Class ThreadAgnosticAttribute
Inherits Attribute
Dim instance As ThreadAgnosticAttribute
[<SealedAttribute>]
type ThreadAgnosticAttribute =
class
inherit Attribute
end
The ThreadAgnosticAttribute type exposes the following members.
Constructors Remarks
If this attribute is set on a layout, it could be rendered on the another thread.
This could be more efficient as it's skipped when not needed.
If context like
HttpContext.Current is needed, which is only available on the main thread, this attribute should not be applied.
See the AsyncTargetWrapper and BufferTargetWrapper with the
PrecalculateVolatileLayouts(LogEventInfo) , using
Precalculate(LogEventInfo)
Apply this attribute when:
- The result can we rendered in another thread. Delaying this could be more efficient. And/Or,
- The result should not be precalculated, for example the target sends some extra context information.
See Also