NLog/NLog

Created: 2015-11-10 15:01 Updated: 2015-11-10 15:01 Source: https://github.com/NLog/NLog Notebook: All Tech/Frontend Development

Skip to content

Targets

Julian Verdurmen edited this page 19 days ago · 37 revisions

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 68747470733a2f2f696d672e736869656c64732e696f2f6e756765742f762f4e4c6f672e737667.bin

  • AspResponse - Outputs log messages through the ASP Response object.
  • 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 68747470733a2f2f696d672e736869656c64732e696f2f6e756765742f762f4e4c6f672e457874656e6465642e737667.bin

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

NLog.Web package 68747470733a2f2f696d672e736869656c64732e696f2f6e756765742f762f4e4c6f672e5765622e737667.bin

  • 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 68747470733a2f2f696d672e736869656c64732e696f2f6e756765742f762f4e4c6f672e5765622e737667.bin

  • 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 68747470733a2f2f696d672e736869656c64732e696f2f6e756765742f762f4e4c6f672e5369676e616c522e737667.bin

External packages

External packages, not maintained by the NLog team.

Package Version Description
Elastic Search 68747470733a2f2f696d672e736869656c64732e696f2f6e756765742f762f4e4c6f672e546172676574732e456c61737469635365617263682e737667.bin Write to Elastic Search servers.
elmah.io 68747470733a2f2f696d672e736869656c64732e696f2f6e756765742f762f656c6d61682e696f2e6e6c6f672e737667.bin Sends logs to elmah.io. elmah.io is an online service for logging messages in the cloud.
GrowlNotify 68747470733a2f2f696d672e736869656c64732e696f2f6e756765742f762f4e4c6f672e47726f776c2e737667.bin Sends logs via Growl for Windows, a desktop notification system.
Logentries 68747470733a2f2f696d672e736869656c64732e696f2f6e756765742f762f4c6f67656e74726965732e6e6c6f672e737667.bin Writing to www.logentries.com
Pushover 687474703a2f2f696d672e736869656c64732e696f2f6e756765742f762f4e4c6f672e546172676574732e507573686f7665722e737667.bin Sends logs via Pushover, an Android/iOS/Desktop push notification system.
RabbitMQ 68747470733a2f2f696d672e736869656c64732e696f2f6e756765742f762f4e4c6f672e5261626269744d512e737667.bin Sends logs over a RabbitMQ message broker. It allows you to combine your logs in real time across multiple platforms and systems.
SignalR 68747470733a2f2f696d672e736869656c64732e696f2f6e756765742f762f4e4c6f672e5369676e616c522e737667.bin Custom NLog target for sending log events to a SignalR hub.
Syslog 68747470733a2f2f696d672e736869656c64732e696f2f6e756765742f762f4e4c6f672e546172676574732e5379736c6f672e737667.bin Write to Syslog.
XML 68747470733a2f2f696d672e736869656c64732e696f2f6e756765742f762f4e4c6f672e586d6c2e737667.bin Write to XML files.

Writing your own target

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


View static HTML