Ads by Lake Quincy Media

Wiki Navigation

 
Gibraltar - Learn about the best analysis tool for NLog

MSMQ target

NLog documentation is a Wiki, which allows registered users to edit its content.
If you want to contribute, please create a user account and contact Jarek to get edit access.

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

Supported in

Configuration Syntax

<targets>
  <target xsi:type="MSMQ"
          name="String"
          useXmlEncoding="Boolean"
          encoding="Encoding"
          layout="Layout"
          recoverable="Boolean"
          createQueueIfNotExists="Boolean"
          label="Layout"
          queue="Layout" />
</targets>
Read more about using the Configuration File.

Parameters

  • General Options
  • name - Name of the target.
  • Layout Options
  • useXmlEncoding - Indicates whether to use the XML format when serializing message.Boolean Default: False
  • encoding - Encoding to be used when writing text to the queue.Encoding
  • layout - Layout used to format log messages.Layout Required. Default: ${longdate}|${level:uppercase=true}|${logger}|${message}
  • Queue Options
  • recoverable - Indicates whether to use recoverable messages (with guaranteed delivery).Boolean Default: False
  • createQueueIfNotExists - Indicates whether to create the queue if it doesn't exists.Boolean Default: False
  • label - Label to associate with each message.Layout Default: NLog
    By default no label is associated.
  • queue - Name of the queue to write to.Layout Required.
    To write to a private queue on a local machine use .\private$\QueueName. For other available queue names, consult MSMQ documentation.

Notes

The MSMQ target requires that:

  • NLog.extended.dll be along side the NLog.dll at runtime.
  • The machine doing the logging have MSMQ installed with the Active Directory Domain Services Integration option. If the option is not installed, the target will throw an exception.
  • The queue being written to is NOT transactional.
Ads by Lake Quincy Media