NLog.Targets.Target
Represents logging target.
Gets a value indicating whether the target has been initialized.
NLog Layout are by default threadsafe, so multiple threads can be rendering logevents at the same time.
This ensure high concurrency with no lock-congestion for the application-threads, especially when using AsyncTargetWrapper
or AsyncTaskTarget.
But if using custom Layout or LayoutRenderer that are not
threadsafe, then this option can enabled to protect against thread-concurrency-issues. Allowing one
to update to NLog 5.0 without having to fix custom/external layout-dependencies.
Gets the logging configuration this target is part of.
Gets or sets the name of the target.
Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers
Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit
Gets the object which can be used to synchronize asynchronous operations that must rely on the .
protected Target()
Obsolete and replaced by Setup with NLog v5.2.
Register a custom Target.
Obsolete and replaced by Setup with NLog v5.2.
Register a custom Target.
Closes the target to release any initialized resources
Closes the target.
Releases unmanaged and - optionally - managed resources.
Flush any pending log messages (in case of asynchronous targets).
Flush any pending log messages
Initializes the target before writing starts
Merges (copies) the event context properties from any event info object stored in
parameters of the given event info object.
Calls the Precalculate on each volatile layout
used by this target.
This method won't prerender if all layouts in this target are thread-agnostic.
Renders the logevent into a string-result using the provided layout
Renders the logevent into a result-value by using the provided layout
Resolve from DI ServiceRepository
Writes logging event to the target destination
Writes async log event to the log target.
Writes an array of logging events to the log target. By default it iterates on all
events and passes them to "Write" method. Inheriting classes can use this method to
optimize batch writes.
Writes the log to the target.
Writes the array of log events.
Writes the array of log events.
Writes a log event to the log target, in a thread safe manner.
Any override of this method has to provide their own synchronization mechanism.
!WARNING! Custom targets should only override this method if able to provide their
own synchronization mechanism. Layout-objects are not guaranteed to be
thread-safe, so using them without a SyncRoot-object can be dangerous.
Writes an array of logging events to the log target, in a thread safe manner.
Any override of this method has to provide their own synchronization mechanism.
!WARNING! Custom targets should only override this method if able to provide their
own synchronization mechanism. Layout-objects are not guaranteed to be
thread-safe, so using them without a SyncRoot-object can be dangerous.
protected virtual void WriteFailedNotInitialized(AsyncLogEventInfo logEvent, Exception initializeException)
LogEvent is written to target, but target failed to successfully initialize