Targets

Rolf Kristensen edited this page May 24, 2018 · 72 revisions
Clone this wiki locally

Use

Targets are used to display, store, or pass log messages to another destination. There are two kinds of target; those that receive and handle the messages, and those that buffer or route the messages to another target. The second group are called 'wrapper' targets.

NLog supports creating custom targets. For more information, see: Extending NLog

Targets

NLog package Version

  • Chainsaw - Sends log messages to the remote instance of Chainsaw application from log4j.
  • ColoredConsole - Writes log messages to the console with customizable coloring.
  • Console - Writes log messages to the console.
  • Database - Writes log messages to the database using an ADO.NET provider.
  • Debug - Mock target - useful for testing.
  • Debugger - Writes log messages to the attached managed debugger.
  • EventLog - Writes log message to the Event Log.
  • File - Writes log messages to one or more files.
  • LogReceiverService - Sends log messages to a NLog Receiver Service (using WCF or Web Services).
  • Mail - Sends log messages by email using SMTP protocol.
  • Memory - Writes log messages to an ArrayList in memory for programmatic retrieval.
  • MethodCall - Calls the specified static method on each log message and passes contextual parameters to it.
  • Network - Sends log messages over the network.
  • NLogViewer - Sends log messages to the remote instance of NLog Viewer.
  • Null - Discards log messages. Used mainly for debugging and benchmarking.
  • OutputDebugString - Outputs log messages through the OutputDebugString() Win32 API.
  • PerfCounter - Increments specified performance counter on each write.
  • Trace - Sends log messages through System.Diagnostics.Trace.
  • WebService - Calls the specified web service on each log message.

Wrappers

NLog.Extended package Version

  • MSMQ - Writes log message to the specified message queue handled by MSMQ.

NLog.Web package Version

  • AspNetTrace - Writes log messages to the ASP.NET trace.

Wrappers

  • AspNetBufferingWrapper - Buffers log events for the duration of ASP.NET request and sends them down to the wrapped target at the end of a request.

NLog.Windows.Forms package Version

  • FormControl - Logs text to Windows.Forms.Control.Text property control of specified Name.
  • MessageBox - Pops up log messages as message boxes.
  • RichTextBox - Log text a Rich Text Box control in an existing or new form.

NLog.Elmah package Version

External packages

External packages, not maintained by the NLog team.

Package Version Description
Amazon SNS Version Writes NLog messages to Amazon SNS.
Amazon SQS Version Writes NLog messages to Amazon SQS.
AzureTableStorage Version Writes NLog messages to Azure TableStorage
Microsoft ApplicationInsights Version Writes NLog messages to Microsoft ApplicationInsights
Elastic Search Version Writes to Elastic Search servers.
elmah.io Version Sends logs to elmah.io. elmah.io is an online service for logging messages in the cloud.
ExceptionLess Version Writes NLog messages to www.exceptionless.com
Fluentd Version Writes NLog messages to Fluentd
Gelf Version Writes NLog messages to GrayLog2 - Gelf
Gelf4NLog Version Writes NLog messages to GrayLog2 - Gelf
NLog.Gelf Version Writes NLog messages to GrayLog2 - Gelf
EasyGelf Version Writes NLog messages to GrayLog2 - Gelf
Glimpse Version Show NLog information in Glimpse.
GrowlNotify Version Sends logs via Growl for Windows, a desktop notification system.
LiveSwitch Version Sends logs via named pipes to a local service that you can monitor in real-time with a UI.
Loggly Version Writes NLog messages to www.loggly.com
Logentries Version Writes NLog messages to www.logentries.com
Loupe Version Writes NLog messages to Gibraltar www.onloupe.com
MongoDB Version Writes NLog messages to MongoDB.
LiteDB Version Writes NLog messages to LiteDB.
Pushover Version Sends logs via Pushover, an Android/iOS/Desktop push notification system.
RabbitMQ Version Sends logs over a RabbitMQ message broker. It allows you to combine your logs in real time across multiple platforms and systems.
Raygun Version Writes NLog messages to www.raygun.com
Redis Version Writes NLog messages to Redis.
ReflectInsight Version Writes NLog messages to www.reflectsoftware.com.
RavenDB Version Writes NLog messages to RavenDB.
Sentry Version Writes NLog messages to www.sentry.io
Seq Version Writes NLog messages to www.getseq.net
SignalR Version Writes NLog messages to a SignalR hub.
Splunk Version Writes NLog messages to Splunk
Syslog Version Writes NLog messages to Syslog.

Writing your own target

NLog supports custom target. For more information, see: Extending NLog